From: Aleksander Ɓukasz Date: Mon, 6 May 2013 20:35:54 +0000 (+0200) Subject: Visual editor - new node shortcuts in the toolbar X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/a201669e7bd63f06683f9dc741fd55721ebf4551 Visual editor - new node shortcuts in the toolbar --- diff --git a/modules/visualEditor.js b/modules/visualEditor.js index cef7de7..d5ff4b5 100644 --- a/modules/visualEditor.js +++ b/modules/visualEditor.js @@ -353,7 +353,7 @@ rng.modules.visualEditor = function(sandbox) { mediator.toolbarButtonToggled(btn.attr('data-btn'), btn.hasClass('active')); } if(btn.attr('data-btn-type') === 'cmd') { - mediator.toolbarButtonCmd(btn.attr('data-btn')); + mediator.toolbarButtonCmd(btn.attr('data-btn'), btn.attr('data-meta')); } }); }, @@ -425,12 +425,19 @@ rng.modules.visualEditor = function(sandbox) { if(btn === 'tags') view.toggleTags(toggle); }, - toolbarButtonCmd: function(btn) { + toolbarButtonCmd: function(btn, meta) { if(btn === 'new-node') { + var wlxmlTag = toolbarView.getOption('newTag-tag'); + var wlxmlClass = toolbarView.getOption('newTag-class'); + if(meta) { + var split = meta.split('/'); + wlxmlTag = split[0]; + wlxmlClass = split[1]; + } if(window.getSelection().isCollapsed) - view.insertNewNode(toolbarView.getOption('newTag-tag'), toolbarView.getOption('newTag-class')); + view.insertNewNode(wlxmlTag, wlxmlClass); else { - this.wrapWithNodeRequest(toolbarView.getOption('newTag-tag'), toolbarView.getOption('newTag-class')); + this.wrapWithNodeRequest(wlxmlTag, wlxmlClass); }