editor: canvas keys handling - wrapping document transformations in transactions
[fnpeditor.git] / src / editor / modules / mainBar / mainBar.js
1 define([
2 'libs/jquery',
3 'libs/underscore',
4 'libs/text!./template.html'], function($, _, template) {
5
6 'use strict';
7
8 return function(sandbox) {
9
10     var view = $(_.template(template)());
11     view.find('button').click(function(e) {
12         e.preventDefault();
13         sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));
14     });
15
16     return {
17         start: function() { sandbox.publish('ready'); },
18         getView: function() {return view;},
19         setCommandEnabled: function(cmd, enabled) {
20             view.find('[data-cmd='+cmd+']').toggleClass('disabled', !enabled);
21         },
22         setVersion: function(version) {
23             view.find('.version').text(version);
24         }
25     };
26
27 };
28
29 });