1 define(['libs/jquery', 'libs/underscore', 'utils/wlxml', 'libs/text!./template.html'], function($, _, wlxmlUtils, template) {
5 return function(sandbox) {
8 node: $(_.template(template)({tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames})),
12 this.node.find('button').click(function(e) {
14 var btn = $(e.currentTarget),
15 btnName = btn.attr('data-name'),
16 meta = btn.attr('data-meta'),
20 if(btn.attr('data-btn-type') === 'toggle') {
21 command = 'toggle-' + command;
22 btn.toggleClass('active');
23 params.toggle = btn.hasClass('active');
26 if(btnName === 'new-node') {
27 command = 'newNodeRequested';
28 params.wlxmlTag = view.getOption('newTag-tag');
29 params.wlxmlClass = view.getOption('newTag-class');
31 var split = meta.split('/');
32 params.wlxmlTag = split[0];
33 params.wlxmlClass = split[1];
39 if(command === 'undo' || command === 'redo') {
40 params.callback = function(disable) {
41 btn.attr('disabled', !disable);
45 sandbox.publish('command', command, params);
48 getOption: function(option) {
49 return this.node.find('.rng-module-documentToolbar-toolbarOption[data-option=' + option +']').val();
56 start: function() { sandbox.publish('ready'); },
57 getView: function() { return view.node; },
58 getOption: function(option) { return view.getOption(option); }