From b2ed6c0477904d9bcbf8494043f231a5197f6b78 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 7 Aug 2013 15:53:02 +0200 Subject: [PATCH 1/1] Fix: After breaking node element into two non empty ones via enter move caret to the second one --- modules/documentCanvas/canvas/canvas.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 873b39e..9282d20 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -284,16 +284,23 @@ $.extend(Canvas.prototype, { var elements = position.element.split({offset: position.offset}), newEmpty, - goto; + goto, + gotoOptions; if(position.offsetAtBeginning) newEmpty = elements.first; else if(position.offsetAtEnd) newEmpty = elements.second; + if(newEmpty) { goto = newEmpty.append(documentElement.DocumentTextElement.create({text: ''}, this)); - canvas.setCurrentElement(goto); + gotoOptions = {}; + } else { + goto = elements.second; + gotoOptions = {caretTo: 'start'}; } + + canvas.setCurrentElement(goto, gotoOptions); } } } -- 2.20.1