simplify
authorJan Szejko <janek37@gmail.com>
Tue, 28 Feb 2017 14:58:45 +0000 (15:58 +0100)
committerJan Szejko <janek37@gmail.com>
Tue, 27 Mar 2018 15:01:49 +0000 (17:01 +0200)
(cherry picked from commit 27d9dcb)

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

index becb355..147ca58 100644 (file)
@@ -238,22 +238,16 @@ var keyEventHandlers = [
             );
         },
         run: function(e,s) {
             );
         },
         run: function(e,s) {
-            var direction, caretTo, cursorAtOperationEdge, goto, element;
+            var goto, element;
 
             if(e.key === KEYS.BACKSPACE) {
 
             if(e.key === KEYS.BACKSPACE) {
-                direction = 'above';
-                caretTo = 'end';
-                cursorAtOperationEdge = s.isAtBeginning(); // always true?
                 element = s.element;
             }
             else {
                 element = s.element;
             }
             else {
-                direction = 'below';
-                caretTo = 'start';
-                cursorAtOperationEdge = s.isAtEnd(); // always true?
-                element = cursorAtOperationEdge && s.canvas.getNearestTextElement(direction, s.element);
+                element = s.canvas.getNearestTextElement('below', s.element);
             }
 
             }
 
-            if(!cursorAtOperationEdge || !element) {
+            if(!element) {
                 return;
             }
 
                 return;
             }