From: Aleksander Ɓukasz Date: Thu, 20 Mar 2014 10:37:37 +0000 (+0100) Subject: editor: dropping a working draft X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/635d44e05306b5bd5f5238a31a122528fee1e779 editor: dropping a working draft --- diff --git a/src/editor/modules/data/data.js b/src/editor/modules/data/data.js index 7488390..ef1c87d 100644 --- a/src/editor/modules/data/data.js +++ b/src/editor/modules/data/data.js @@ -238,6 +238,12 @@ return function(sandbox) { }); dialog.show(); }, + dropDraft: function() { + logger.debug('Dropping a draft...'); + wlxmlDocument.loadXML(sandbox.getBootstrappedData().document); + draftDirty = false; + logger.debug('Draft dropped'); + }, getDocumentId: function() { return document_id; }, diff --git a/src/editor/modules/mainBar/mainBar.js b/src/editor/modules/mainBar/mainBar.js index ecf6812..e2e09c3 100644 --- a/src/editor/modules/mainBar/mainBar.js +++ b/src/editor/modules/mainBar/mainBar.js @@ -8,7 +8,7 @@ define([ return function(sandbox) { var view = $(_.template(template)()); - view.find('button').click(function(e) { + view.find('[data-cmd]').click(function(e) { e.preventDefault(); sandbox.publish('cmd.' + $(e.target).attr('data-cmd')); }); diff --git a/src/editor/modules/mainBar/template.html b/src/editor/modules/mainBar/template.html index e3c971b..eeecd62 100644 --- a/src/editor/modules/mainBar/template.html +++ b/src/editor/modules/mainBar/template.html @@ -1,6 +1,7 @@
diff --git a/src/editor/modules/rng/rng.js b/src/editor/modules/rng/rng.js index bed3e86..78145a5 100644 --- a/src/editor/modules/rng/rng.js +++ b/src/editor/modules/rng/rng.js @@ -151,6 +151,9 @@ return function(sandbox) { sourceEditor.commitChanges(); } sandbox.getModule('data').saveDocument(); + }, + 'cmd.drop-draft': function() { + sandbox.getModule('data').dropDraft(); } };