From 09bbbfa460a9b5122c56a14e9995dd7eec0fff6e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 3 Oct 2024 16:20:16 +0300 Subject: [PATCH 1/2] [PEF] Fix Bug 70647 --- .../pdfeditor/main/app/controller/LeftMenu.js | 12 ++--- apps/pdfeditor/main/app/controller/Main.js | 44 +++++++++---------- .../pdfeditor/main/app/view/FileMenuPanels.js | 16 +++---- 3 files changed, 32 insertions(+), 40 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/LeftMenu.js b/apps/pdfeditor/main/app/controller/LeftMenu.js index cd05c18e6b..59fd62b37d 100644 --- a/apps/pdfeditor/main/app/controller/LeftMenu.js +++ b/apps/pdfeditor/main/app/controller/LeftMenu.js @@ -431,13 +431,13 @@ define([ /** coauthoring begin **/ if (this.mode.isEdit && this.mode.canCoAuthoring && canPDFSave && !this.mode.isOffline) { if (this.mode.canChangeCoAuthoring) { - // fast_coauth = Common.localStorage.getBool("pdfe-settings-coauthmode", true); - fast_coauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"); + fast_coauth = Common.localStorage.getBool("pdfe-settings-coauthmode", false); // false by default! + Common.Utils.InternalSettings.set("pdfe-settings-coauthmode", fast_coauth); this.api.asc_SetFastCollaborative(fast_coauth); } - // value = Common.localStorage.getItem((fast_coauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict"); - value = Common.Utils.InternalSettings.get(fast_coauth ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict"); + value = Common.localStorage.getItem((fast_coauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict"); + Common.Utils.InternalSettings.set((fast_coauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict", value); switch(value) { case 'all': value = Asc.c_oAscCollaborativeMarksShowType.All; break; case 'none': value = Asc.c_oAscCollaborativeMarksShowType.None; break; @@ -472,8 +472,8 @@ define([ if (this.mode.isEdit && canPDFSave) { if (this.mode.canChangeCoAuthoring || !fast_coauth) {// can change co-auth. mode or for strict mode - // value = parseInt(Common.localStorage.getItem("pdfe-settings-autosave")); - value = Common.Utils.InternalSettings.get("pdfe-settings-autosave"); + value = parseInt(Common.localStorage.getItem("pdfe-settings-autosave")); + Common.Utils.InternalSettings.set("pdfe-settings-autosave", value); this.api.asc_setAutoSaveGap(value); } } diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 0619855f85..ab067910a0 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -1402,39 +1402,39 @@ define([ }, loadCoAuthSettings: function() { - var fastCoauth = true, - autosave = 1, + var fastCoauth = false, + autosave_def = this.appOptions.isOffline ? 1 : 0, + autosave = autosave_def, value, isEdit = this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit; if (isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { - if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'fast' by default - value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; - if (value===null && this.appOptions.customization && this.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when coEditing.mode is null + 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!==undefined) ? (this.editorConfig.coEditing.mode==='fast' ? 1 : 0) : null; + if (value===null && this.appOptions.customization && this.appOptions.customization.autosave) { + value = 1; // use customization.autosave only when coEditing.mode is null } } else { value = Common.localStorage.getItem("pdfe-settings-coauthmode"); if (value===null) { - value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='strict' ? 0 : 1) : null; + value = (this.editorConfig.coEditing && this.editorConfig.coEditing.mode!==undefined) ? (this.editorConfig.coEditing.mode==='fast' ? 1 : 0) : null; if (value===null && !Common.localStorage.itemExists("pdfe-settings-autosave") && - this.appOptions.customization && this.appOptions.customization.autosave===false) { - value = 0; // use customization.autosave only when pdfe-settings-coauthmode and pdfe-settings-autosave are null + this.appOptions.customization && this.appOptions.customization.autosave) { + value = 1; // use customization.autosave only when pdfe-settings-coauthmode and pdfe-settings-autosave are null } } } - fastCoauth = (value===null || parseInt(value) == 1); + fastCoauth = value && parseInt(value) === 1; Common.Utils.InternalSettings.set("pdfe-settings-showchanges-fast", Common.localStorage.getItem("pdfe-settings-showchanges-fast") || 'none'); Common.Utils.InternalSettings.set("pdfe-settings-showchanges-strict", Common.localStorage.getItem("pdfe-settings-showchanges-strict") || 'last'); - // in first version with co-editing set strict mode on start - fastCoauth = false; } else if (!isEdit && (this.appOptions.isPDFFill || this.appOptions.isRestrictedEdit)) { fastCoauth = true; + autosave = 1; } else if (this.appOptions.canLiveView && !this.appOptions.isOffline) { // viewer value = Common.localStorage.getItem("pdfe-settings-view-coauthmode"); - if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'fast' by default - value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='strict' ? 0 : 1; + if (!this.appOptions.canChangeCoAuthoring || value===null) { // Use coEditing.mode or 'strict' by default + value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0; } - fastCoauth = (parseInt(value) == 1); + fastCoauth = value && (parseInt(value) == 1); // don't show collaborative marks in live viewer Common.Utils.InternalSettings.set("pdfe-settings-showchanges-fast", 'none'); @@ -1446,11 +1446,9 @@ define([ if (isEdit) { value = Common.localStorage.getItem("pdfe-settings-autosave"); - if (value === null && this.appOptions.customization && this.appOptions.customization.autosave === false) - value = 0; - autosave = (!fastCoauth && value !== null) ? parseInt(value) : (this.appOptions.canCoAuthoring ? 1 : 0); - // in first version with co-editing set autosave=false on start (except offline files) - !this.appOptions.isOffline && (autosave = 0); + if (value === null && this.appOptions.customization && this.appOptions.customization.autosave===(!autosave_def)) + value = autosave_def ? 0 : 1; + autosave = (!fastCoauth && value !== null) ? parseInt(value) : (this.appOptions.canCoAuthoring ? autosave_def : 0); } Common.Utils.InternalSettings.set("pdfe-settings-coauthmode", fastCoauth); @@ -2301,11 +2299,11 @@ define([ callback: _.bind(function(btn, dontshow){ if (dontshow) Common.localStorage.setItem("pdfe-hide-try-undoredo", 1); if (btn == 'custom') { - // Common.localStorage.setItem("pdfe-settings-coauthmode", 0); + Common.localStorage.setItem("pdfe-settings-coauthmode", 0); Common.Utils.InternalSettings.set("pdfe-settings-coauthmode", false); this.api.asc_SetFastCollaborative(false); this._state.fastCoauth = false; - // Common.localStorage.setItem("pdfe-settings-showchanges-strict", 'last'); + Common.localStorage.setItem("pdfe-settings-showchanges-strict", 'last'); Common.Utils.InternalSettings.set("pdfe-settings-showchanges-strict", 'last'); this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.LastChanges); // this.getApplication().getController('Common.Controllers.ReviewChanges').applySettings(); @@ -2347,7 +2345,7 @@ define([ if (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) { if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { var oldval = this._state.fastCoauth; - this._state.fastCoauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"); + this._state.fastCoauth = Common.localStorage.getBool("pdfe-settings-coauthmode"); if (this._state.fastCoauth && !oldval) this.synchronizeChanges(); } diff --git a/apps/pdfeditor/main/app/view/FileMenuPanels.js b/apps/pdfeditor/main/app/view/FileMenuPanels.js index d1b8901d90..0b89c8d38f 100644 --- a/apps/pdfeditor/main/app/view/FileMenuPanels.js +++ b/apps/pdfeditor/main/app/view/FileMenuPanels.js @@ -876,13 +876,9 @@ define([], function () { Common.Utils.InternalSettings.set("pdfe-settings-livecomment", this.chLiveComment.isChecked()); Common.Utils.InternalSettings.set("pdfe-settings-resolvedcomment", this.chResolvedComment.isChecked()); if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && canPDFSave) { - // in first version with co-editing don't save co-editing mode to local storate - // this.mode.canChangeCoAuthoring && Common.localStorage.setItem("pdfe-settings-coauthmode", this.rbCoAuthModeFast.getValue() ? 1 : 0 ); - // Common.localStorage.setItem(this.rbCoAuthModeFast.getValue() ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict", - // this.rbShowChangesNone.getValue()?'none':this.rbShowChangesLast.getValue()?'last':'all'); - this.mode.canChangeCoAuthoring && Common.Utils.InternalSettings.set("pdfe-settings-coauthmode", !!this.rbCoAuthModeFast.getValue()); - Common.Utils.InternalSettings.set(this.rbCoAuthModeFast.getValue() ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict", - this.rbShowChangesNone.getValue()?'none':this.rbShowChangesLast.getValue()?'last':'all'); + this.mode.canChangeCoAuthoring && Common.localStorage.setItem("pdfe-settings-coauthmode", this.rbCoAuthModeFast.getValue() ? 1 : 0 ); + Common.localStorage.setItem(this.rbCoAuthModeFast.getValue() ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict", + this.rbShowChangesNone.getValue()?'none':this.rbShowChangesLast.getValue()?'last':'all'); } else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer Common.localStorage.setItem("pdfe-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0); } @@ -890,10 +886,8 @@ define([], function () { Common.localStorage.setItem("pdfe-settings-fontrender", this.cmbFontRender.getValue()); var item = this.cmbFontRender.store.findWhere({value: 'custom'}); Common.localStorage.setItem("pdfe-settings-cachemode", item && !item.get('checked') ? 0 : 1); - if (this.mode.isEdit && (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"))) { - Common.Utils.InternalSettings.set("pdfe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); - this.mode.isOffline && Common.localStorage.setItem("pdfe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); - } + if (this.mode.isEdit && (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"))) + Common.localStorage.setItem("pdfe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); if (this.mode.canForcesave) Common.localStorage.setItem("pdfe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); From 6b03d0fa3de500ea3b8f2cd81b220bea0edc726c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 3 Oct 2024 16:32:43 +0300 Subject: [PATCH 2/2] For Bug 70218 --- .../main/app/controller/DocumentHolder.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index f8072bdf78..06c0263031 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1160,12 +1160,8 @@ define([ cellinfo = this.api.asc_getCellInfo(); if (controller) { var comments = cellinfo.asc_getComments(); - if (comments) { - if (comments.length) { - controller.onEditComments(comments); - } else if (this.permissions.canCoAuthoring) { - controller.addDummyComment(); - } + if (comments && !comments.length && this.permissions.canCoAuthoring) { + controller.addDummyComment(); } } }