From: Aleksander Ɓukasz Date: Tue, 1 Apr 2014 20:18:53 +0000 (+0200) Subject: editor: fix - check for success before changing current element X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/198b0be1a6d1c67dd60d6d5a2b0472e1165e8168 editor: fix - check for success before changing current element --- diff --git a/src/editor/modules/documentCanvas/commands.js b/src/editor/modules/documentCanvas/commands.js index a411a37..a165132 100644 --- a/src/editor/modules/documentCanvas/commands.js +++ b/src/editor/modules/documentCanvas/commands.js @@ -94,8 +94,13 @@ commands.register('list', function(canvas, params) { node2 = parent2.wlxmlNode, doc = node1.document; - doc.createList({node1: node1, node2: node2}); - canvas.setCurrentElement(selectionFocus.element, {caretTo: selectionFocus.offset}); + doc.transaction(function() { + doc.createList({node1: node1, node2: node2}); + }, { + success: function() { + canvas.setCurrentElement(selectionFocus.element, {caretTo: selectionFocus.offset}); + } + }); }); commands.register('toggle-grid', function(canvas, params) {