From: Aleksander Ɓukasz Date: Wed, 17 Jul 2013 11:58:10 +0000 (+0200) Subject: Setting caret after moving list elements up one level X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/b2aa09d74099e36b7cd45189691d647f33d4688c Setting caret after moving list elements up one level --- diff --git a/modules/documentCanvas/commands.js b/modules/documentCanvas/commands.js index 52f03d8..0c9fef0 100644 --- a/modules/documentCanvas/commands.js +++ b/modules/documentCanvas/commands.js @@ -26,7 +26,9 @@ commands.register('unwrap-node', function(canvas) { parent2 = selectionEnd.element.parent() || undefined; if(canvas.list.areItemsOfTheSameList({element1: parent1, element2: parent2})) { + var selectionAnchor = cursor.getSelectionAnchor(); canvas.list.extractItems({element1: parent1, element2: parent2}); + canvas.setCurrentElement(selectionAnchor.element, {caretTo: selectionAnchor.offset}); } else if(!cursor.isSelecting()) { var toUnwrap = cursor.getPosition().element, parent = toUnwrap.unwrap();