From: Aleksander Ɓukasz Date: Tue, 6 Aug 2013 14:52:42 +0000 (+0200) Subject: Do note split root document node element on hitting enter X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/2139e7253380f71ffeb8d58728aeabfb66f739b2?ds=sidebyside;hp=27aad148fb13a6705a8fd91ea693bd8ea46da396 Do note split root document node element on hitting enter --- diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 9b57d93..318a22f 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -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;