X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/eeefba6bcac6faaaed876e43fbf37f4405600b27..65c64d3696e38bda0e2259d48c8d02978da7a3d8:/src/editor/modules/documentCanvas/canvas/keyboard.js?ds=sidebyside diff --git a/src/editor/modules/documentCanvas/canvas/keyboard.js b/src/editor/modules/documentCanvas/canvas/keyboard.js index a6f52cf..57a245e 100644 --- a/src/editor/modules/documentCanvas/canvas/keyboard.js +++ b/src/editor/modules/documentCanvas/canvas/keyboard.js @@ -44,6 +44,16 @@ handlers.push({key: KEYS.ENTER, position = cursor.getPosition(), element = position.element; + if(Object.keys(cursor.getPosition()).length === 0) { + var currentElement = canvas.getCurrentNodeElement(); + if(currentElement) { + var added = currentElement.after({tag: currentElement.getWlxmlTag() || 'div', klass: currentElement.getWlxmlClass() || 'p'}); + added.append({text:''}); + canvas.setCurrentElement(added, {caretTo: 'start'}); + } + return; + } + if(!cursor.isSelecting()) { if(event.ctrlKey) { var added = element.after({tag: element.getWlxmlTag() || 'div', klass: element.getWlxmlClass() || 'p'});