X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5766035cdc88ebe92caab7af494e5e077235d5e0..ac50cae92710f684c801ad933b924de2bec2b460:/src/editor/modules/documentCanvas/canvas/keyboard.js 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}); }, {