refactoring
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 9 Aug 2013 10:23:37 +0000 (12:23 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 9 Aug 2013 11:54:46 +0000 (13:54 +0200)
modules/documentCanvas/canvas/canvas.js

index a65375e..1b39183 100644 (file)
@@ -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('');
                     }