From: Jan Szejko Date: Tue, 28 Feb 2017 14:58:45 +0000 (+0100) Subject: simplify X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/e4833347b89be4ad9534ecd3f836f0606326ee81?ds=inline simplify (cherry picked from commit 27d9dcb) --- diff --git a/src/editor/modules/documentCanvas/canvas/keyboard.js b/src/editor/modules/documentCanvas/canvas/keyboard.js index becb355..147ca58 100644 --- a/src/editor/modules/documentCanvas/canvas/keyboard.js +++ b/src/editor/modules/documentCanvas/canvas/keyboard.js @@ -238,22 +238,16 @@ var keyEventHandlers = [ ); }, run: function(e,s) { - var direction, caretTo, cursorAtOperationEdge, goto, element; + var goto, element; if(e.key === KEYS.BACKSPACE) { - direction = 'above'; - caretTo = 'end'; - cursorAtOperationEdge = s.isAtBeginning(); // always true? 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; }