From 81de52f79be487b1c323a01cb971189953f8ca77 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 12 Apr 2022 18:31:21 +0300 Subject: [PATCH 1/4] [DE] Fix permission.comment=false --- .../main/app/controller/Toolbar.js | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 59f352856..7125ea6c0 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -724,21 +724,23 @@ define([ plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false, plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false; - this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment}); - this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment}); - this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment}); - if (this.api.asc_IsContentControl()) { - var control_props = this.api.asc_GetContentControlProperties(), - spectype = control_props ? control_props.get_SpecificType() : Asc.c_oAscContentControlSpecificType.None; - this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || - spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime, {array: this.btnsComment}); + if (this.btnsComment) { + this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment}); + this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment}); + this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment}); + if (this.api.asc_IsContentControl()) { + var control_props = this.api.asc_GetContentControlProperties(), + spectype = control_props ? control_props.get_SpecificType() : Asc.c_oAscContentControlSpecificType.None; + this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || + spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime, {array: this.btnsComment}); + } + this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.btnsComment}); + this.toolbar.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.btnsComment}); + this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.btnsComment}); + this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.btnsComment}); + this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: this.btnsComment}); + this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.btnsComment}); } - this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.btnsComment}); - this.toolbar.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.btnsComment}); - this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.btnsComment}); - this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.btnsComment}); - this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: this.btnsComment}); - this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.btnsComment}); }, onApiFocusObject: function(selectedObjects) { @@ -814,9 +816,9 @@ define([ this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])}); this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])}); - this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: this.btnsComment.concat(toolbar.btnsPageBreak).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt, + this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: toolbar.btnsPageBreak.concat(this.btnsComment).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt, toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])}); - this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.btnsComment.concat(toolbar.btnsPageBreak).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt, + this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: toolbar.btnsPageBreak.concat(this.btnsComment).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt, toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])}); this.toolbar.lockToolbar(Common.enumLock.inChart, in_chart, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnInsertEquation])}); @@ -888,15 +890,17 @@ define([ if (toolbar.listStylesAdditionalMenuItem && (frame_pr===undefined) !== toolbar.listStylesAdditionalMenuItem.isDisabled()) toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined); - // comments - this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment}); - this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment}); - this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment}); - if (control_props) { - var spectype = control_props.get_SpecificType(); - this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || - spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime, - {array: this.btnsComment}); + if (this.btnsComment) { + // comments + this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment}); + this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment}); + this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment}); + if (control_props) { + var spectype = control_props.get_SpecificType(); + this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || + spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime, + {array: this.btnsComment}); + } } if (frame_pr) { this._state.suppress_num = !!frame_pr.get_SuppressLineNumbers(); @@ -3217,6 +3221,7 @@ define([ var me = this; me.appOptions = config; + this.btnsComment = []; if ( config.canCoAuthoring && config.canComments ) { this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment, [ Common.enumLock.paragraphLock, Common.enumLock.headerLock, Common.enumLock.richEditLock, Common.enumLock.plainEditLock, Common.enumLock.richDelLock, Common.enumLock.plainDelLock, From 0edf12b186e4ad016f3b9f24c3b9b4f24258f3b1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 12:23:17 +0300 Subject: [PATCH 2/4] Set live viewer by default (for new license) --- .../main/app/controller/Main.js | 21 ++++++++++--------- .../main/app/controller/Main.js | 21 ++++++++++--------- .../main/app/controller/Main.js | 21 ++++++++++--------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index f841a5cf7..9d38616e0 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1345,7 +1345,7 @@ define([ (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; - + // need to check live view connections!!! if (this._isDocReady) this.applyLicense(); }, @@ -1547,9 +1547,12 @@ define([ Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this)); Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); - // change = true by default in editor, change = false by default in viewer + // change = true by default in editor + this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && + (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1597,13 +1600,11 @@ define([ } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } else { - value = Common.localStorage.getItem("de-settings-view-coauthmode"); - if (value===null) { - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } + value = Common.localStorage.getItem("de-settings-view-coauthmode"); + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'strict' by default for canLiveView=false or 'fast' by default for canLiveView=true + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : + this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : + this.appOptions.canLiveView ? 1 : 0; } fastCoauth = (parseInt(value) == 1); } else { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 69237409d..066c9822f 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -966,7 +966,7 @@ define([ (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; - + // need to check live view connections!!! if (this._isDocReady) this.applyLicense(); }, @@ -1194,9 +1194,12 @@ define([ this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout); this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features, this.appOptions.canBrandingExt); - // change = true by default in editor, change = false by default in viewer + // change = true by default in editor + this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && + (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); @@ -1239,13 +1242,11 @@ define([ } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } else { - value = Common.localStorage.getItem("pe-settings-view-coauthmode"); - if (value===null) { - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } + value = Common.localStorage.getItem("pe-settings-view-coauthmode"); + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'strict' by default for canLiveView=false or 'fast' by default for canLiveView=true + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : + this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : + this.appOptions.canLiveView ? 1 : 0; } fastCoauth = (parseInt(value) == 1); } else { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index e38e48a33..b97a21800 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1053,7 +1053,7 @@ define([ (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; - + // need to check live view connections!!! if (this._isDocReady) this.applyLicense(); }, @@ -1282,10 +1282,13 @@ define([ this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments; - // change = true by default in editor, change = false by default in viewer + // change = true by default in editor + this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || - !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ; + !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && + (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle) { this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); @@ -1343,13 +1346,11 @@ define([ } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { fastCoauth = true; } else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } else { - value = Common.localStorage.getItem("sse-settings-view-coauthmode"); - if (value===null) { - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; - } + value = Common.localStorage.getItem("sse-settings-view-coauthmode"); + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'strict' by default for canLiveView=false or 'fast' by default for canLiveView=true + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : + this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : + this.appOptions.canLiveView ? 1 : 0; } fastCoauth = (parseInt(value) == 1); } else { From 3a2c2513cff3aafa15fe900f725925231d7e8573 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 12:54:53 +0300 Subject: [PATCH 3/4] Fix loading if coEditing==null --- apps/documenteditor/main/app/controller/Main.js | 8 ++++---- apps/documenteditor/mobile/src/controller/Main.jsx | 2 +- apps/presentationeditor/main/app/controller/Main.js | 8 ++++---- apps/presentationeditor/mobile/src/controller/Main.jsx | 2 +- apps/spreadsheeteditor/main/app/controller/Main.js | 8 ++++---- apps/spreadsheeteditor/mobile/src/controller/Main.jsx | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 9d38616e0..075c2b5fd 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -473,7 +473,7 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); @@ -1549,10 +1549,10 @@ define([ // change = true by default in editor this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true - this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && - (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : - (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; + (this.appOptions.canLiveView ? !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 8675fc898..ad7558b87 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -133,7 +133,7 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 066c9822f..d62ba8a12 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -430,7 +430,7 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); @@ -1196,10 +1196,10 @@ define([ // change = true by default in editor this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true - this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || + this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && - (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : - (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; + (this.appOptions.canLiveView ? !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; this.loadCoAuthSettings(); this.applyModeCommonElements(); diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index a28803971..f9d8ed33f 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -124,7 +124,7 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index b97a21800..fd66dbd5d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -504,7 +504,7 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); @@ -1285,10 +1285,10 @@ define([ // change = true by default in editor this.appOptions.canLiveView = true; //params.asc_canLiveViewer(); // viewer: change=false by default when no flag canLiveViewer (i.g. old license), change=true by default when canLiveViewer==true this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && this.appOptions.canCoAuthoring && - !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || + !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) || !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && - (this.appOptions.canLiveView ? !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : - (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; + (this.appOptions.canLiveView ? !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) : + (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true)) ; if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle) { this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins); diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 0b7925cf3..37d678f56 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -171,7 +171,7 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) + if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); const appOptions = this.props.storeAppOptions; From b58e49aea10c322ee2e35bd898a70935956fb5f4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Apr 2022 13:48:25 +0300 Subject: [PATCH 4/4] Change sending mode to sdk for live viewer --- apps/documenteditor/main/app/controller/Main.js | 4 +--- apps/documenteditor/mobile/src/controller/Main.jsx | 4 ++-- apps/presentationeditor/main/app/controller/Main.js | 4 +--- apps/presentationeditor/mobile/src/controller/Main.jsx | 4 ++-- apps/spreadsheeteditor/main/app/controller/Main.js | 4 +--- apps/spreadsheeteditor/mobile/src/controller/Main.jsx | 4 ++-- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 075c2b5fd..60d9c45f6 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -472,9 +472,7 @@ define([ docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - - if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) - docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); + docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index ad7558b87..43dbbf10c 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -133,8 +133,8 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) - docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); + // docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + docInfo.put_CoEditingMode('strict'); // need to change!!! let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); docInfo.asc_putIsEnabledMacroses(!!enable); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index d62ba8a12..4f04f6a21 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -429,9 +429,7 @@ define([ docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - - if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) - docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); + docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index f9d8ed33f..8fc91169b 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -124,8 +124,8 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) - docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); + // docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + docInfo.put_CoEditingMode('strict'); // need to change!!! let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); docInfo.asc_putIsEnabledMacroses(!!enable); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index fd66dbd5d..a7175fe23 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -503,9 +503,7 @@ define([ docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys); docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - - if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) - docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); + docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 37d678f56..a4bd03aa2 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -171,8 +171,8 @@ class MainController extends Component { docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - if (this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.mode!==undefined) - docInfo.put_CoEditingMode(this.editorConfig.coEditing.mode); + // docInfo.put_CoEditingMode(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object' ? this.editorConfig.coEditing.mode || 'fast' : 'fast'); + docInfo.put_CoEditingMode('strict'); // need to change!!! const appOptions = this.props.storeAppOptions; let enable = !appOptions.customization || (appOptions.customization.macros !== false);