[DE PE] refactoring

This commit is contained in:
Maxim Kadushkin 2018-02-16 02:52:44 +03:00
parent 6d385730b1
commit cb82ea8230
3 changed files with 5 additions and 10 deletions

View file

@ -1543,9 +1543,7 @@ define([
/** coauthoring end **/ /** coauthoring end **/
}, },
onDocumentCanSaveChanged: function (isCanSave) { onDocumentCanSaveChanged: function (isCanSave) {
var application = this.getApplication(), var toolbarView = this.getApplication().getController('Toolbar').getView();
toolbarController = application.getController('Toolbar'),
toolbarView = toolbarController.getView();
if (toolbarView && this.api && !toolbarView._state.previewmode) { if (toolbarView && this.api && !toolbarView._state.previewmode) {
var isSyncButton = $('.icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'), var isSyncButton = $('.icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),

View file

@ -2762,7 +2762,7 @@ define([
// hide 'print' and 'save' buttons group and next separator // hide 'print' and 'save' buttons group and next separator
me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); me.toolbar.btnPrint.$el.parents('.group').hide().next().hide();
// hide 'undo' and 'redo' buttons and get container // hide 'undo' and 'redo' buttons and retrieve parent container
var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent(); var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent();
// move 'paste' button to the container instead of 'undo' and 'redo' // move 'paste' button to the container instead of 'undo' and 'redo'

View file

@ -409,8 +409,7 @@ define([
onEditComplete: function(cmp) { onEditComplete: function(cmp) {
var application = this.getApplication(), var application = this.getApplication(),
toolbarController = application.getController('Toolbar'), toolbarView = application.getController('Toolbar').getView('Toolbar');
toolbarView = toolbarController.getView('Toolbar');
application.getController('DocumentHolder').getView('DocumentHolder').focus(); application.getController('DocumentHolder').getView('DocumentHolder').focus();
if (this.api && this.api.asc_isDocumentCanSave) { if (this.api && this.api.asc_isDocumentCanSave) {
@ -1281,10 +1280,8 @@ define([
} }
}, },
onDocumentCanSaveChanged: function (isCanSave) { onDocumentCanSaveChanged: function (isCanSave) {
var application = this.getApplication(), var toolbarView = this.getApplication().getController('Toolbar').getView('Toolbar');
toolbarController = application.getController('Toolbar'), if ( toolbarView ) {
toolbarView = toolbarController.getView('Toolbar');
if (toolbarView) {
var isSyncButton = $('.icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'), var isSyncButton = $('.icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
forcesave = this.appOptions.forcesave, forcesave = this.appOptions.forcesave,
isDisabled = !isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; isDisabled = !isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave;