X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/cd087df95dce695f044472b6f017fbb697e90b7f..7427515e04e110e91793887b873f5853751c271a:/src/editor/modules/documentCanvas/commands.js 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);