From a132113f20073907fd2907a93c75c9d699516ee6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 30 Jan 2014 17:12:54 +0100 Subject: [PATCH] editor: fix - perform inserting empty footnote operation within one transaction --- src/editor/modules/documentCanvas/commands.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/editor/modules/documentCanvas/commands.js b/src/editor/modules/documentCanvas/commands.js index e0fc3f8..4c52c91 100644 --- a/src/editor/modules/documentCanvas/commands.js +++ b/src/editor/modules/documentCanvas/commands.js @@ -212,14 +212,17 @@ commands.register('footnote', function(canvas, params) { void(params); var cursor = canvas.getCursor(), position = cursor.getPosition(), - asideNode, asideElement; + asideNode, asideElement, node; if(cursor.isSelectingWithinElement()) { asideNode = position.element.data('wlxmlNode').wrapWith({tagName: 'aside', attrs:{'class': 'footnote'}, start: cursor.getSelectionStart().offset, end: cursor.getSelectionEnd().offset}); } else { - asideNode = position.element.data('wlxmlNode').divideWithElementNode({tagName: 'aside', attrs:{'class': 'footnote'}}, {offset: position.offset}); - asideNode.append({text: ''}); + node = position.element.data('wlxmlNode'); + node.document.transaction(function() { + asideNode = node.divideWithElementNode({tagName: 'aside', attrs:{'class': 'footnote'}}, {offset: position.offset}); + asideNode.append({text: ''}); + }); } asideElement = utils.findCanvasElement(asideNode); -- 2.20.1