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, 14 Mar 2017 14:30:25 +0000 (15:30 +0100)
src/editor/modules/documentCanvas/canvas/keyboard.js

index 99201bc..924a880 100644 (file)
@@ -342,6 +342,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});
                     }
                 }