Do note split root document node element on hitting enter
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 6 Aug 2013 14:52:42 +0000 (16:52 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 6 Aug 2013 14:52:42 +0000 (16:52 +0200)
modules/documentCanvas/canvas/canvas.js

index 9b57d93..318a22f 100644 (file)
@@ -146,7 +146,13 @@ $.extend(Canvas.prototype, {
                     var cursor = canvas.getCursor();
                     if(!cursor.isSelecting()) {
                         var position = cursor.getPosition(),
-                            elements = position.element.split({offset: position.offset}),
+                            element = position.element;
+
+                        if(!(element.parent().parent())) {
+                            return false; // top level element is unsplittable
+                        }
+
+                        var elements = position.element.split({offset: position.offset}),
                             newEmpty,
                             goto;