diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index d4744a57b..aed29897b 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1600,7 +1600,7 @@ define([ if (this._state.isDocModified !== isModified || force) { var title = this.defaultTitleText; - if (!_.isEmpty(appHeader.getDocumentCaption())) + if (appHeader && !_.isEmpty(appHeader.getDocumentCaption())) title = appHeader.getDocumentCaption() + ' - ' + title; if (isModified) { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index d93a72b86..20b123b3b 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1311,7 +1311,7 @@ define([ if (this._state.isDocModified !== isModified || force) { var title = this.defaultTitleText; - if (!_.isEmpty(appHeader.getDocumentCaption())) + if (appHeader && !_.isEmpty(appHeader.getDocumentCaption())) title = appHeader.getDocumentCaption() + ' - ' + title; if (isModified) { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 20d62500b..8de80cf02 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -393,7 +393,7 @@ define([ docInfo.put_Token(data.doc.token); docInfo.put_Permissions(_permissions); - this.headerView.setDocumentCaption(data.doc.title); + this.headerView && this.headerView.setDocumentCaption(data.doc.title); } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); @@ -1494,30 +1494,31 @@ define([ updateWindowTitle: function(change, force) { if (this._state.isDocModified !== change || force) { - var title = this.defaultTitleText; + if (this.headerView) { + var title = this.defaultTitleText; - if (!_.isEmpty(this.headerView.getDocumentCaption())) - title = this.headerView.getDocumentCaption() + ' - ' + title; + if (!_.isEmpty(this.headerView.getDocumentCaption())) + title = this.headerView.getDocumentCaption() + ' - ' + title; - if (change) { - clearTimeout(this._state.timerCaption); - if (!_.isUndefined(title)) { - title = '* ' + title; - this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(), true); + if (change) { + clearTimeout(this._state.timerCaption); + if (!_.isUndefined(title)) { + title = '* ' + title; + this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(), true); + } + } else { + if (this._state.fastCoauth && this._state.usersCount>1) { + var me = this; + this._state.timerCaption = setTimeout(function () { + me.headerView.setDocumentCaption(me.headerView.getDocumentCaption(), false); + }, 500); + } else + this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(), false); } - } else { - if (this._state.fastCoauth && this._state.usersCount>1) { - var me = this; - this._state.timerCaption = setTimeout(function () { - me.headerView.setDocumentCaption(me.headerView.getDocumentCaption(), false); - }, 500); - } else - this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(), false); + if (window.document.title != title) + window.document.title = title; } - if (window.document.title != title) - window.document.title = title; - Common.Gateway.setDocumentModified(change); this._state.isDocModified = change;