X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/8f2b5f13ac74ab18a0c2bac0e2d8209a40ce3c1c..c601e8aff30efc0b4fd69765d5671e3ee88c4bf4:/modules/documentCanvas/commands.js diff --git a/modules/documentCanvas/commands.js b/modules/documentCanvas/commands.js index b0fb093..b08348e 100644 --- a/modules/documentCanvas/commands.js +++ b/modules/documentCanvas/commands.js @@ -55,15 +55,15 @@ commands.register('toggle-list', function(canvas, params) { parent1 = selectionStart.element.parent() || undefined, parent2 = selectionEnd.element.parent() || undefined; + var selectionFocus = cursor.getSelectionFocus(); if(params.toggle) { - var selectionFocus = cursor.getSelectionFocus(); canvas.list.create({element1: parent1, element2: parent2}); - canvas.setCurrentElement(selectionFocus.element, {caretTo: selectionFocus.offset}); } else { if(canvas.list.areItemsOfTheSameList({element1: parent1, element2: parent2})) { canvas.list.extractItems({element1: parent1, element2: parent2, merge: false}); } } + canvas.setCurrentElement(selectionFocus.element, {caretTo: selectionFocus.offset}); }); commands.register('toggle-grid', function(canvas, params) { @@ -99,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) {