editor: handle situation when element doesn't implement getVerticallyFirstTextElement
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 4 Jun 2014 10:44:04 +0000 (12:44 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 11 Jun 2014 08:29:41 +0000 (10:29 +0200)
src/editor/modules/documentCanvas/canvas/canvas.js

index b234dd8..5bd5e85 100644 (file)
@@ -349,7 +349,7 @@ $.extend(Canvas.prototype, Backbone.Events, {
             if(byBrowser && byBrowser.parent().sameNode(nodeToLand)) {
                 return byBrowser;
             }
-            return e.getVerticallyFirstTextElement({considerChildren: false});
+            return _.isFunction(e.getVerticallyFirstTextElement) ? e.getVerticallyFirstTextElement({considerChildren: false}) : null;
         }.bind(this);
         var _markAsCurrent = function(element) {
             if(element instanceof documentElement.DocumentTextElement) {