From 198b0be1a6d1c67dd60d6d5a2b0472e1165e8168 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Aleksander=20=C5=81ukasz?=
 <aleksander.lukasz@nowoczesnapolska.org.pl>
Date: Tue, 1 Apr 2014 22:18:53 +0200
Subject: [PATCH] editor: fix - check for success before changing current
 element

---
 src/editor/modules/documentCanvas/commands.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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) {
-- 
2.20.1