From 5a730ffccd95a757b05bf9a1ac188155e1eec539 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 20 Apr 2022 15:43:39 +0300 Subject: [PATCH] [DE] Set offline viewer for pdf/djvu/xps/oxps --- apps/documenteditor/main/app/controller/Main.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 17065bab1..cc29c1909 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -473,11 +473,6 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default - this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer - this.editorConfig.coEditing.mode || 'fast'; - docInfo.put_CoEditingMode(coEditMode); - var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); @@ -485,6 +480,12 @@ define([ // docInfo.put_Review(this.permissions.review); var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType); + var coEditMode = (type && typeof type[1] === 'string') ? 'strict' : // offline viewer for pdf|djvu|xps|oxps + !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + this.editorConfig.coEditing.mode || 'fast'; + docInfo.put_CoEditingMode(coEditMode); + if (type && typeof type[1] === 'string') { this.permissions.edit = this.permissions.review = false; } @@ -1563,7 +1564,7 @@ define([ Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); // change = true by default in editor - this.appOptions.canLiveView = !!params.asc_getLiveViewerSupport() && (this.editorConfig.mode === 'view'); // viewer: change=false when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true + this.appOptions.canLiveView = !!params.asc_getLiveViewerSupport() && (this.editorConfig.mode === 'view') && !isPDFViewer; // viewer: change=false when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || this.appOptions.canLiveView && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false);