From 3d1bdbdff07968d8a6c5ea9239a53cf30c6768e4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 11 Oct 2023 12:36:22 +0300 Subject: [PATCH] [PDFE] Enable download file with changes --- apps/pdfeditor/main/app/controller/Main.js | 7 ++++--- apps/pdfeditor/main/app/controller/Toolbar.js | 11 +++++------ apps/pdfeditor/main/app/view/Toolbar.js | 6 +++--- apps/pdfeditor/main/locale/en.json | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 1eb39e6f74..98602a0fb7 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -725,7 +725,7 @@ define([ forcesave = this.appOptions.forcesave, isSyncButton = (toolbarView.btnCollabChanges.rendered) ? toolbarView.btnCollabChanges.cmpEl.hasClass('notify') : false, isDisabled = !cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave || !this.appOptions.isPDFEdit && !this.appOptions.isPDFAnnotate; - toolbarView.btnSave.setDisabled(isDisabled); + toolbarView.btnSave.setDisabled(isDisabled && !this.appOptions.saveAlwaysEnabled); } Common.UI.HintManager.clearHints(true); @@ -1152,6 +1152,7 @@ define([ this.appOptions.buildVersion = params.asc_getBuildVersion(); this.appOptions.canForcesave = this.appOptions.isPDFEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; + this.appOptions.saveAlwaysEnabled = true; this.appOptions.canEditComments= this.appOptions.isOffline || !this.permissions.editCommentAuthorOnly; this.appOptions.canDeleteComments= this.appOptions.isOffline || !this.permissions.deleteCommentAuthorOnly; if ((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.commentAuthorOnly===true) { @@ -1833,7 +1834,7 @@ define([ var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, isDisabled = !isModified && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave || !this.appOptions.isPDFEdit && !this.appOptions.isPDFAnnotate; - toolbarView.btnSave.setDisabled(isDisabled); + toolbarView.btnSave.setDisabled(isDisabled && !this.appOptions.saveAlwaysEnabled); } /** coauthoring begin **/ @@ -1850,7 +1851,7 @@ define([ var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, isDisabled = !isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave || !this.appOptions.isPDFEdit && !this.appOptions.isPDFAnnotate; - toolbarView.btnSave.setDisabled(isDisabled); + toolbarView.btnSave.setDisabled(isDisabled && !this.appOptions.saveAlwaysEnabled); } }, diff --git a/apps/pdfeditor/main/app/controller/Toolbar.js b/apps/pdfeditor/main/app/controller/Toolbar.js index 092ff202b9..805e207abd 100644 --- a/apps/pdfeditor/main/app/controller/Toolbar.js +++ b/apps/pdfeditor/main/app/controller/Toolbar.js @@ -394,9 +394,7 @@ define([ me.api.asc_DownloadAs(); else if (btn==='copy' || btn==='download') { me._state.isFromToolbarDownloadAs = (btn==='copy'); - var options = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF, btn==='copy'); - options.asc_setTextParams(new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine)); - me.api.asc_DownloadAs(options); + me.api.asc_DownloadOrigin(btn==='copy'); } Common.NotificationCenter.trigger('edit:complete', toolbar); } @@ -408,7 +406,7 @@ define([ return; this.api.asc_Save(); - toolbar.btnSave.setDisabled(!toolbar.mode.forcesave); + toolbar.btnSave.setDisabled(!toolbar.mode.forcesave && !toolbar.mode.saveAlwaysEnabled); Common.component.Analytics.trackEvent('Save'); Common.component.Analytics.trackEvent('ToolBar', 'Save'); } @@ -656,7 +654,7 @@ define([ this.toolbar.lockToolbar(Common.enumLock.undoLock, this._state.can_undo!==true, {array: [this.toolbar.btnUndo]}); this.toolbar.lockToolbar(Common.enumLock.redoLock, this._state.can_redo!==true, {array: [this.toolbar.btnRedo]}); this.toolbar.lockToolbar(Common.enumLock.copyLock, this._state.can_copycut!==true, {array: [this.toolbar.btnCopy, this.toolbar.btnCut]}); - this.toolbar.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate); + this.toolbar.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate && !this.mode.saveAlwaysEnabled); this._state.activated = true; }, @@ -810,7 +808,8 @@ define([ txtNeedCommentMode: 'To save changes to the file, switch to Сommenting mode. Or you can download a copy of the modified file.', txtNeedDownload: 'At the moment, PDF viewer can only save new changes in separate file copies. It doesn\'t support co-editing and other users won\'t see your changes unless you share a new file version.', txtDownload: 'Download', - txtSaveCopy: 'Save copy' + txtSaveCopy: 'Save copy', + errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.' }, PDFE.Controllers.Toolbar || {})); }); diff --git a/apps/pdfeditor/main/app/view/Toolbar.js b/apps/pdfeditor/main/app/view/Toolbar.js index 5535407308..b7fa9f9fef 100644 --- a/apps/pdfeditor/main/app/view/Toolbar.js +++ b/apps/pdfeditor/main/app/view/Toolbar.js @@ -128,7 +128,7 @@ define([ ); this.btnSaveCls = 'btn-save'; - this.btnSaveTip = this.tipSave + Common.Utils.String.platformKey('Ctrl+S'); + this.btnSaveTip = this.tipSave;// + Common.Utils.String.platformKey('Ctrl+S'); this.btnPrint = new Common.UI.Button({ id: 'id-toolbar-btn-print', @@ -689,7 +689,7 @@ define([ this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); } - this.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate); + this.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate && !this.mode.saveAlwaysEnabled); Common.Gateway.collaborativeChanges(); }, @@ -721,7 +721,7 @@ define([ this.synchTooltip.hide(); this.btnCollabChanges.updateHint(this.btnSaveTip); - this.btnSave.setDisabled(!me.mode.forcesave || !me.mode.isPDFEdit && !me.mode.isPDFAnnotate); + this.btnSave.setDisabled(!me.mode.forcesave || !me.mode.isPDFEdit && !me.mode.isPDFAnnotate && !me.mode.saveAlwaysEnabled); this._state.hasCollaborativeChanges = false; } } diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index d926d9db17..2e04ae2055 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -438,6 +438,7 @@ "PDFE.Controllers.Toolbar.txtNeedCommentMode": "To save changes to the file, switch to Сommenting mode. Or you can download a copy of the modified file.", "PDFE.Controllers.Toolbar.txtNeedDownload": "At the moment, PDF viewer can only save new changes in separate file copies. It doesn't support co-editing and other users won't see your changes unless you share a new file version.", "PDFE.Controllers.Toolbar.txtSaveCopy": "Save copy", + "PDFE.Controllers.Toolbar.errorAccessDeny": "You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.", "PDFE.Controllers.Viewport.textFitPage": "Fit to Page", "PDFE.Controllers.Viewport.textFitWidth": "Fit to Width", "PDFE.Controllers.Viewport.txtDarkMode": "Dark mode",