[4]: VEditor Components - GeekTree0101/VEditorKit GitHub Wiki
-
VEditorMediaNode
- VEditorImageNode
- VEditorVideoNode
- VEditorMediaPlaceholderNode
- VEditorDeleteMediaNode
- VEditorOpenGraphNode
- VEditorTypingControlNode
-
VEditorTextCellNode
- VEditorTextNode
- VEditorTextStorage
- VEditorTextNode
If you make VEditorMediaNode subclass
you will got advantage about delete & textInsertion automatically binding on VEditorNode
you don't care delete & text insertion indexPath calculate
open class VEditorMediaPlaceholderNode: ASCellNode {
public init(xmlTag: String) { ... }
public func onSuccess(_ replaceContent: VEditorMediaContent) { ... }
public func onFailed() { ... }
}
You just handle onSuccess or onFailed method after network call
init(xmlTag: String, url: URL) {
super.init(xmlTag: xmlTag)
MockService
.getOgObject(url)
.subscribe(onNext: { [weak self] attributes in
guard let `self` = self else {
fatalError()
}
let replaceContent = VOpenGraphContent(self.xmlTag,
attributes: attributes)
self.onSuccess(replaceContent)
}, onError: { [weak self] _ in
self?.onFailed()
}).disposed(by: disposeBag)
}
open class VEditorDeleteMediaNode: ASControlNode {
open lazy var deleteButtonNode: ASControlNode
open lazy var closeIconNode: ASImageNode
open let deleteColor: UIColor
open let deleteIconImage: UIImage?
public init(_ color: UIColor, deleteIconImage: UIImage?) { }
}
VEditorOpenGraphNode is basic open graph cell example usage
open class VEditorTypingControlNode: ASButtonNode {
public var typingStyle: VEditorStyle
public let xmlTag: String
public let rule: VEditorRule
public let isBlockStyle: Bool
public let isExternalHandler: Bool
public init(_ xmlTag: String,
rule: VEditorRule,
isBlockStyle: Bool = false,
isExternalHandler: Bool = false) {
- typingStyle: Typing Attribute Style Object
- xmlTag: Typing Identifier
- rule: Editor Rule
- isBlockStyle: Heading, Quote etc. In this case, selectedRange will convert to paragraphRange and use it
- isExternalHandler: Regex Text Attribute Apply Delegate
open class VEditorTextCellNode: ASCellNode {
public required init(isEdit: Bool,
placeholderText: NSAttributedString?,
attributedText: NSAttributedString,
rule: VEditorRule,
regexDelegate: VEditorRegexApplierDelegate? = nil,
automaticallyGenerateLinkPreview: Bool = false) {
- isEdit: Edit mode
- placeholderText: Text placeholder
- attributedText: Parsed attributed text
- rule: Editor Rule
- regexDelegate: Regex Delegate Example
- automaticallyGenerateLinkPreview: If you set Yes, than will make link preview after typing link