Skip to content

Commit cf53358

Browse files
committed
Modify the point of deletion of text node
1 parent 88c61e7 commit cf53358

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

VEditorKit/Classes/VEditorTextNode.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ open class VEditorTextNode: ASEditableTextNode, ASEditableTextNodeDelegate {
119119
open func editableTextNode(_ editableTextNode: ASEditableTextNode,
120120
shouldChangeTextIn range: NSRange,
121121
replacementText text: String) -> Bool {
122-
123-
if (text == "\n" || text == " "),
122+
if text.isEmpty {
123+
guard self.isDisplayingPlaceholder() else { return true }
124+
self.textEmptiedRelay.accept(())
125+
return true
126+
} else if (text == "\n" || text == " "),
124127
let context = self.textStorage?
125128
.automaticallyApplyLinkAttribute(self) {
126129
guard self.automaticallyGenerateLinkPreview else { return true }
@@ -172,9 +175,6 @@ open class VEditorTextNode: ASEditableTextNode, ASEditableTextNodeDelegate {
172175

173176
open func editableTextNodeDidUpdateText(_ editableTextNode: ASEditableTextNode) {
174177
self.textStorage?.didUpdateText(self)
175-
176-
guard self.isDisplayingPlaceholder() else { return }
177-
self.textEmptiedRelay.accept(())
178178
}
179179

180180
open func updateCurrentTypingAttribute(_ attribute: VEditorStyleAttribute,

0 commit comments

Comments
 (0)