[SSE] refactoring

This commit is contained in:
Maxim Kadushkin 2017-04-27 18:25:02 +03:00
parent 44ce5e85ad
commit d2de0c7dfc
3 changed files with 19 additions and 43 deletions

View file

@ -922,13 +922,6 @@ define([
}
});
if (this.toolbarView) {
this.toolbarView.on('insertimage', _.bind(me.onInsertImage, me));
this.toolbarView.on('insertshape', _.bind(me.onInsertShape, me));
this.toolbarView.on('insertchart', _.bind(me.onInsertChart, me));
this.toolbarView.on('inserttextart', _.bind(me.onInsertTextArt, me));
}
var value = Common.localStorage.getItem('sse-settings-unit');
Common.Utils.Metric.setCurrentMetric((value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric());
@ -1599,25 +1592,6 @@ define([
}
},
loadLanguages: function() {
},
onInsertImage: function() {
this.getApplication().getController('RightMenu').onInsertImage();
},
onInsertChart: function() {
this.getApplication().getController('RightMenu').onInsertChart();
},
onInsertShape: function() {
this.getApplication().getController('RightMenu').onInsertShape();
},
onInsertTextArt: function() {
this.getApplication().getController('RightMenu').onInsertTextArt();
},
onInternalCommand: function(data) {
if (data) {
switch (data.command) {

View file

@ -57,6 +57,12 @@ define([
this._state = {};
this.addListeners({
'Toolbar': {
'insertimage': this.onInsertImage.bind(this),
'insertshape': this.onInsertShape.bind(this),
'insertchart': this.onInsertChart.bind(this),
'inserttextart': this.onInsertTextArt.bind(this)
},
'RightMenu': {
'rightmenuclick': this.onRightMenuClick
}

View file

@ -174,8 +174,6 @@ define([
/**
* UI Events
*/
toolbar.btnNewDocument.on('click', _.bind(this.onNewDocument, this));
toolbar.btnOpenDocument.on('click', _.bind(this.onOpenDocument, this));
toolbar.btnPrint.on('click', _.bind(this.onPrint, this));
toolbar.btnSave.on('click', _.bind(this.onSave, this));
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
@ -283,21 +281,19 @@ define([
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this));
},
onNewDocument: function(btn, e) {
if (this.api)
this.api.asc_openNewDocument();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'New Document');
},
onOpenDocument: function(btn, e) {
if (this.api)
this.api.asc_loadDocumentFromDisk();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Open Document');
},
// onNewDocument: function(btn, e) {
// this.api.asc_openNewDocument();
//
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// Common.component.Analytics.trackEvent('ToolBar', 'New Document');
// },
//
// onOpenDocument: function(btn, e) {
// this.api.asc_loadDocumentFromDisk();
//
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// Common.component.Analytics.trackEvent('ToolBar', 'Open Document');
// },
onPrint: function(e) {
Common.NotificationCenter.trigger('print', this.toolbar);