X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5766035cdc88ebe92caab7af494e5e077235d5e0..248bc3fefa3eed44a6ffed7374bea9310962fb88:/src/editor/modules/documentCanvas/canvas/keyboard.js?ds=inline diff --git a/src/editor/modules/documentCanvas/canvas/keyboard.js b/src/editor/modules/documentCanvas/canvas/keyboard.js index 7ae6b27..d8052ed 100644 --- a/src/editor/modules/documentCanvas/canvas/keyboard.js +++ b/src/editor/modules/documentCanvas/canvas/keyboard.js @@ -376,9 +376,16 @@ var keyEventHandlers = [ return s.type === 'caret' && e.key === KEYS.ENTER && !s.element.parent().isRootElement(); }, run: function(e, s) { - var result, goto, gotoOptions; + var parent = s.element.parent(), + children = parent.children(), + result, goto, gotoOptions; void(e); e.preventDefault(); + + if(children.length === 1 && s.element.isEmpty()) { + return; + } + s.canvas.wlxmlDocument.transaction(function() { result = s.element.wlxmlNode.breakContent({offset: s.offset}); }, {