From: Aleksander Ɓukasz Date: Fri, 9 Aug 2013 10:23:37 +0000 (+0200) Subject: refactoring X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/7c7abb572061965f2d3a1f1d29a212a3c6318e34?ds=inline;hp=7bc06393365fdffe695cef6dd825edf4ce521919 refactoring --- diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index a65375e..1b39183 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -227,7 +227,11 @@ $.extend(Canvas.prototype, { cursorAtOperationEdge = position.offsetAtEnd; } - if(element.getText().length === 1 || selectsWholeTextElement()) { + var willDeleteWholeText = function() { + return element.getText().length === 1 || selectsWholeTextElement(); + } + + if(willDeleteWholeText()) { e.preventDefault(); element.setText(''); }