Skip to content

Commit

Permalink
Merge pull request 'fix/bugfix' (#59) from fix/bugfix into release/v8…
Browse files Browse the repository at this point in the history
….2.0
  • Loading branch information
Julia Radzhabova committed Oct 3, 2024
2 parents e387446 + 6b03d0f commit 4e62621
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 46 deletions.
12 changes: 6 additions & 6 deletions apps/pdfeditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down
44 changes: 21 additions & 23 deletions apps/pdfeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand Down
16 changes: 5 additions & 11 deletions apps/pdfeditor/main/app/view/FileMenuPanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,24 +876,18 @@ 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);
}
/** coauthoring end **/
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);

Expand Down
8 changes: 2 additions & 6 deletions apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand Down

0 comments on commit 4e62621

Please sign in to comment.