[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 **/
},
onDocumentCanSaveChanged: function (isCanSave) {
var application = this.getApplication(),
toolbarController = application.getController('Toolbar'),
toolbarView = toolbarController.getView();
var toolbarView = this.getApplication().getController('Toolbar').getView();
if (toolbarView && this.api && !toolbarView._state.previewmode) {
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
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();
// move 'paste' button to the container instead of 'undo' and 'redo'

View file

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