From 6d0b6bbccfb5866596ab491fe4f569b5510bc0d4 Mon Sep 17 00:00:00 2001 From: Kirill Volkov Date: Fri, 11 Feb 2022 12:37:40 +0300 Subject: [PATCH 1/3] added format icons djvu,xps,oxps --- .../main/resources/img/doc-formats/djvu.svg | 26 +++++++++++++++++++ .../main/resources/img/doc-formats/oxps.svg | 11 ++++++++ .../main/resources/img/doc-formats/xps.svg | 11 ++++++++ 3 files changed, 48 insertions(+) create mode 100644 apps/common/main/resources/img/doc-formats/djvu.svg create mode 100644 apps/common/main/resources/img/doc-formats/oxps.svg create mode 100644 apps/common/main/resources/img/doc-formats/xps.svg diff --git a/apps/common/main/resources/img/doc-formats/djvu.svg b/apps/common/main/resources/img/doc-formats/djvu.svg new file mode 100644 index 000000000..4166d9e31 --- /dev/null +++ b/apps/common/main/resources/img/doc-formats/djvu.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/common/main/resources/img/doc-formats/oxps.svg b/apps/common/main/resources/img/doc-formats/oxps.svg new file mode 100644 index 000000000..cdab1aab9 --- /dev/null +++ b/apps/common/main/resources/img/doc-formats/oxps.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/common/main/resources/img/doc-formats/xps.svg b/apps/common/main/resources/img/doc-formats/xps.svg new file mode 100644 index 000000000..cbebe0aa2 --- /dev/null +++ b/apps/common/main/resources/img/doc-formats/xps.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + From c33d67f792481f91a4bf1e02f2a676d51ade851f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 11 Feb 2022 17:54:01 +0300 Subject: [PATCH 2/3] [DE] Fix downloading pdf/xps/oxps/djvu files --- .../main/resources/img/doc-formats/djvu.svg | 36 ++++++++----------- .../app/controller/ApplicationController.js | 2 +- .../main/app/controller/LeftMenu.js | 6 ++-- .../main/app/controller/Main.js | 6 ++-- .../main/app/view/FileMenuPanels.js | 28 +++++++++++---- apps/documenteditor/main/index.html | 3 ++ apps/documenteditor/main/index.html.deploy | 3 ++ apps/documenteditor/main/index_loader.html | 3 ++ .../main/index_loader.html.deploy | 3 ++ 9 files changed, 56 insertions(+), 34 deletions(-) diff --git a/apps/common/main/resources/img/doc-formats/djvu.svg b/apps/common/main/resources/img/doc-formats/djvu.svg index 4166d9e31..1b5927051 100644 --- a/apps/common/main/resources/img/doc-formats/djvu.svg +++ b/apps/common/main/resources/img/doc-formats/djvu.svg @@ -1,26 +1,18 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 793371f41..0a4788bd0 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -494,7 +494,7 @@ define([ enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); docInfo.asc_putIsEnabledPlugins(!!enable); - var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType); + var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType); if (type && typeof type[1] === 'string') { this.permissions.edit = this.permissions.review = false; } diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 21c2587c2..2773fb5eb 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -367,9 +367,11 @@ define([ clickSaveAsFormat: function(menu, format, ext) { // ext isn't undefined for save copy as var me = this, fileType = this.getApplication().getController('Main').document.fileType; - if ( /^pdf|xps|oxps$/.test(fileType)) { - if (format===undefined || format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA || format == Asc.c_oAscFileType.XPS) + if ( /^pdf|xps|oxps|djvu$/.test(fileType)) { + if (format===undefined) this._saveAsFormat(undefined, format, ext); // download original + else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) + this._saveAsFormat(menu, format, ext); else { (new Common.Views.OptionsDialog({ width: 300, diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index bb1c6d83f..112a3d504 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1463,9 +1463,9 @@ define([ this.appOptions.canChat = false; } - var type = /^(?:(djvu))$/.exec(this.document.fileType); - this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string'); - this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string'); + // var type = /^(?:(djvu))$/.exec(this.document.fileType); + this.appOptions.canDownloadOrigin = false; + this.appOptions.canDownload = this.permissions.download !== false; this.appOptions.canUseSelectHandTools = this.appOptions.canUseThumbnails = this.appOptions.canUseViwerNavigation = isPDFViewer; this.appOptions.canDownloadForms = this.appOptions.canLicense && this.appOptions.canDownload; diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 9572efa4a..664c10c78 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -98,12 +98,20 @@ define([ }, render: function() { - if (/^pdf|xps|oxps$/.test(this.fileType)) { + if (/^pdf$/.test(this.fileType)) { this.formats[0].splice(1, 1); // remove pdf this.formats[1].splice(1, 1); // remove pdfa - this.formats[3].push({name: 'Original', imgCls: 'pdf', type: ''}); + this.formats[3].push({name: 'PDF', imgCls: 'pdf', type: ''}); // original pdf + } else if (/^xps|oxps$/.test(this.fileType)) { + this.formats[3].push({name: this.fileType.toUpperCase(), imgCls: this.fileType, type: ''}); // original xps/oxps + } else if (/^djvu$/.test(this.fileType)) { + this.formats = [[ + {name: 'DJVU', imgCls: 'djvu', type: ''}, // original djvu + {name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF} + ]]; } - if (this.mode && !this.mode.canFeatureForms) { + + if (this.mode && !this.mode.canFeatureForms && this.formats.length>2) { this.formats[2].splice(1, 2); this.formats[2] = this.formats[2].concat(this.formats[3]); this.formats[3] = undefined; @@ -186,12 +194,20 @@ define([ }, render: function() { - if (/^pdf|xps|oxps$/.test(this.fileType)) { + if (/^pdf$/.test(this.fileType)) { this.formats[0].splice(1, 1); // remove pdf this.formats[1].splice(1, 1); // remove pdfa - this.formats[3].push({name: 'Original', imgCls: 'pdf', type: '', ext: true}); + this.formats[3].push({name: 'PDF', imgCls: 'pdf', type: '', ext: true}); // original pdf + } else if (/^xps|oxps$/.test(this.fileType)) { + this.formats[3].push({name: this.fileType.toUpperCase(), imgCls: this.fileType, type: '', ext: true}); // original xps/oxps + } else if (/^djvu$/.test(this.fileType)) { + this.formats = [[ + {name: 'DJVU', imgCls: 'djvu', type: '', ext: true}, // original djvu + {name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF, ext: '.pdf'} + ]]; } - if (this.mode && !this.mode.canFeatureForms) { + + if (this.mode && !this.mode.canFeatureForms && this.formats.length>2) { this.formats[2].splice(1, 2); this.formats[2] = this.formats[2].concat(this.formats[3]); this.formats[3] = undefined; diff --git a/apps/documenteditor/main/index.html b/apps/documenteditor/main/index.html index c104a0ee0..f1157d4f0 100644 --- a/apps/documenteditor/main/index.html +++ b/apps/documenteditor/main/index.html @@ -324,6 +324,9 @@ + + + diff --git a/apps/documenteditor/main/index.html.deploy b/apps/documenteditor/main/index.html.deploy index c91525b3a..b3582a90c 100644 --- a/apps/documenteditor/main/index.html.deploy +++ b/apps/documenteditor/main/index.html.deploy @@ -313,6 +313,9 @@ + + + diff --git a/apps/documenteditor/main/index_loader.html b/apps/documenteditor/main/index_loader.html index 990b85a3e..58261a6de 100644 --- a/apps/documenteditor/main/index_loader.html +++ b/apps/documenteditor/main/index_loader.html @@ -285,6 +285,9 @@ + + + diff --git a/apps/documenteditor/main/index_loader.html.deploy b/apps/documenteditor/main/index_loader.html.deploy index 14ec083f8..575f5d4ca 100644 --- a/apps/documenteditor/main/index_loader.html.deploy +++ b/apps/documenteditor/main/index_loader.html.deploy @@ -332,6 +332,9 @@ + + + From ce86232347c995f66328bea83e86b19f023fda30 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 11 Feb 2022 18:05:13 +0300 Subject: [PATCH 3/3] [DE] Close File menu when download original file --- apps/documenteditor/main/app/controller/LeftMenu.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 2773fb5eb..59c2df39d 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -368,9 +368,10 @@ define([ var me = this, fileType = this.getApplication().getController('Main').document.fileType; if ( /^pdf|xps|oxps|djvu$/.test(fileType)) { - if (format===undefined) + if (format===undefined) { this._saveAsFormat(undefined, format, ext); // download original - else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) + menu && menu.hide(); + } else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) this._saveAsFormat(menu, format, ext); else { (new Common.Views.OptionsDialog({