From 389e02647bb404dd750d3f05921b2ad9e9ba0056 Mon Sep 17 00:00:00 2001 From: Geektree0101 Date: Mon, 11 Feb 2019 11:11:26 +0900 Subject: [PATCH] User cannot remove last text node --- VEditorKit/Classes/VEditorNode.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/VEditorKit/Classes/VEditorNode.swift b/VEditorKit/Classes/VEditorNode.swift index e0cafd4..778822d 100644 --- a/VEditorKit/Classes/VEditorNode.swift +++ b/VEditorKit/Classes/VEditorNode.swift @@ -847,7 +847,9 @@ extension VEditorNode { private func deleteUnnecessaryEditableTextIfNeeds(with: UITableView.RowAnimation = .automatic) { guard let indexPath = self.activeTextIndexPath, - self.editorContents.count > 1 else { return } + self.editorContents.count > 1, + indexPath.row != self.editorContents.count - 1 else { return } + self.resignActiveTextNode() self.editorContents.remove(at: indexPath.row) self.tableNode.deleteRows(at: [indexPath], with: with)