X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/b58b8f498d9b5e70aec099829b97af2c4d72da10..bb42027c8fd9ed17234381d3c366c387a20592f0:/modules/documentToolbar/documentToolbar.js?ds=sidebyside diff --git a/modules/documentToolbar/documentToolbar.js b/modules/documentToolbar/documentToolbar.js index a2a1567..a6dd0be 100644 --- a/modules/documentToolbar/documentToolbar.js +++ b/modules/documentToolbar/documentToolbar.js @@ -13,7 +13,7 @@ return function(sandbox) { e.stopPropagation(); var btn = $(e.currentTarget); if(btn.attr('data-btn-type') === 'toggle') { - btn.toggleClass('active') + btn.toggleClass('active'); var event; var btnId = btn.attr('data-btn'); if(btnId === 'grid') @@ -33,22 +33,17 @@ return function(sandbox) { wlxmlTag = split[0]; wlxmlClass = split[1]; } - if(window.getSelection().isCollapsed) { - //view.insertNewNode(wlxmlTag, wlxmlClass); - } - else { - //this.wrapWithNodeRequest(wlxmlTag, wlxmlClass); - } sandbox.publish('newNodeRequested', wlxmlTag, wlxmlClass); + } else { + sandbox.publish('command', btn.attr('data-btn'), btn.attr('data-meta')); } - //sandbox.publish('command', btn.attr('data-btn'), btn.attr('data-meta')); } }); }, getOption: function(option) { return this.node.find('.rng-module-documentToolbar-toolbarOption[data-option=' + option +']').val(); } - } + }; view.setup(); @@ -56,7 +51,7 @@ return function(sandbox) { start: function() { sandbox.publish('ready'); }, getView: function() { return view.node; }, getOption: function(option) { return view.getOption(option); } - } -} + }; +}; }); \ No newline at end of file