X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/8a17c686a21178f73ea93a9d7f2c6ee3bf90aa72..635d44e05306b5bd5f5238a31a122528fee1e779:/src/editor/modules/documentCanvas/commands.js?ds=sidebyside diff --git a/src/editor/modules/documentCanvas/commands.js b/src/editor/modules/documentCanvas/commands.js index 284c613..11a874a 100644 --- a/src/editor/modules/documentCanvas/commands.js +++ b/src/editor/modules/documentCanvas/commands.js @@ -1,7 +1,6 @@ define([ -'modules/documentCanvas/canvas/documentElement', './canvas/utils' -], function(documentElement, utils) { +], function(utils) { 'use strict'; @@ -97,7 +96,7 @@ commands.register('list', function(canvas, params) { }); commands.register('toggle-grid', function(canvas, params) { - canvas.doc().dom().find('[wlxml-tag]').toggleClass('rng-common-hoveredNode', params.toggle); + canvas.doc().dom().parent().toggleClass('grid-on', params.toggle); gridToggled = params.toggle; }); @@ -212,14 +211,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);