From: Aleksander Ɓukasz Date: Wed, 20 Nov 2013 12:35:14 +0000 (+0100) Subject: integration wip: ctrl + enter X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/c57fa472e431ee7e1283e88687025e7c984463c7?ds=inline;hp=7bd1d1364915cd2ead33d97a4396c69e22b39713 integration wip: ctrl + enter --- diff --git a/src/editor/modules/documentCanvas/canvas/keyboard.js b/src/editor/modules/documentCanvas/canvas/keyboard.js index 57a245e..ee36332 100644 --- a/src/editor/modules/documentCanvas/canvas/keyboard.js +++ b/src/editor/modules/documentCanvas/canvas/keyboard.js @@ -56,9 +56,14 @@ handlers.push({key: KEYS.ENTER, if(!cursor.isSelecting()) { if(event.ctrlKey) { - var added = element.after({tag: element.getWlxmlTag() || 'div', klass: element.getWlxmlClass() || 'p'}); - added.append({text:''}); - canvas.setCurrentElement(added, {caretTo: 'start'}); + if(element instanceof documentElement.DocumentTextElement) { + element = element.parent(); + } + var added = element.data('wlxmlNode').after( + {tagName: element.getWlxmlTag() || 'div', attrs: {'class': element.getWlxmlClass() || 'p'}} + ); + added.append({text: ''}); + canvas.setCurrentElement(utils.findCanvasElement(added), {caretTo: 'start'}); } else {