fix weird selection after delete
authorJan Szejko <janek37@gmail.com>
Tue, 14 Mar 2017 14:30:25 +0000 (15:30 +0100)
committerJan Szejko <janek37@gmail.com>
Tue, 27 Mar 2018 14:35:32 +0000 (16:35 +0200)
(cherry picked from commit 18d3b92)

src/editor/modules/documentCanvas/canvas/keyboard.js

index e43ea89..30754c5 100644 (file)
@@ -349,6 +349,10 @@ var keyEventHandlers = [
             }, {
                 success: function() {
                     if(goto) {
             }, {
                 success: function() {
                     if(goto) {
+                        if(!doc.containsNode(goto.wlxmlNode)) {
+                            goto = s.startElement;
+                            caretTo = s.startOffset;
+                        }
                         s.canvas.setCurrentElement(goto, {caretTo: caretTo});
                     }
                 }
                         s.canvas.setCurrentElement(goto, {caretTo: caretTo});
                     }
                 }