X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/1576b7c8102f5e5a5cd40512b5d22565e8f871d2..97b4fb7216407c6623f0e1307bae4b98b0c64b75:/modules/documentCanvas/commands.js diff --git a/modules/documentCanvas/commands.js b/modules/documentCanvas/commands.js index 96b7c70..b08348e 100644 --- a/modules/documentCanvas/commands.js +++ b/modules/documentCanvas/commands.js @@ -55,6 +55,7 @@ commands.register('toggle-list', function(canvas, params) { parent1 = selectionStart.element.parent() || undefined, parent2 = selectionEnd.element.parent() || undefined; + var selectionFocus = cursor.getSelectionFocus(); if(params.toggle) { canvas.list.create({element1: parent1, element2: parent2}); } else { @@ -62,6 +63,7 @@ commands.register('toggle-list', function(canvas, params) { canvas.list.extractItems({element1: parent1, element2: parent2, merge: false}); } } + canvas.setCurrentElement(selectionFocus.element, {caretTo: selectionFocus.offset}); }); commands.register('toggle-grid', function(canvas, params) { @@ -97,6 +99,16 @@ commands.register('newNodeRequested', function(canvas, params) { } }); +commands.register('footnote', function(canvas, params) { + var position = canvas.getCursor().getPosition(); + + var asideElement = position.element.divide({tag: 'aside', klass: 'footnote', offset: position.offset}); + + asideElement.append({text: ''}); + asideElement.toggle(true); + canvas.setCurrentElement(asideElement); +}); + return { run: function(name, params, canvas) {