From c57fa472e431ee7e1283e88687025e7c984463c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 20 Nov 2013 13:35:14 +0100 Subject: [PATCH 1/1] integration wip: ctrl + enter --- src/editor/modules/documentCanvas/canvas/keyboard.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 { -- 2.20.1