From 6512b0f2544c4e6deb2b66de516d8a66ceb2c6e0 Mon Sep 17 00:00:00 2001 From: Ilya Pershin <84379141+IlPer@users.noreply.github.com> Date: Mon, 29 Nov 2021 19:09:24 +0300 Subject: [PATCH 1/5] Update icon-menu-sprite.svg Add icons Undo\Redo --- apps/common/forms/resources/img/icon-menu-sprite.svg | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/common/forms/resources/img/icon-menu-sprite.svg b/apps/common/forms/resources/img/icon-menu-sprite.svg index bcb884c10..8facb7dfd 100644 --- a/apps/common/forms/resources/img/icon-menu-sprite.svg +++ b/apps/common/forms/resources/img/icon-menu-sprite.svg @@ -171,6 +171,18 @@ + + + + + + + + + + + + From 3cc96b8714800dee1b6f3d5206e84d6b40d2e6d3 Mon Sep 17 00:00:00 2001 From: Ilya Pershin <84379141+IlPer@users.noreply.github.com> Date: Mon, 29 Nov 2021 19:18:20 +0300 Subject: [PATCH 2/5] Update icon-menu-sprite.svg --- apps/common/forms/resources/img/icon-menu-sprite.svg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/common/forms/resources/img/icon-menu-sprite.svg b/apps/common/forms/resources/img/icon-menu-sprite.svg index 8facb7dfd..5ce3f5827 100644 --- a/apps/common/forms/resources/img/icon-menu-sprite.svg +++ b/apps/common/forms/resources/img/icon-menu-sprite.svg @@ -1,4 +1,4 @@ - + @@ -172,16 +172,16 @@ - + - + - + - + From fc7ed0f32c62a2532c13d13761204806ecc94db9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 29 Nov 2021 19:22:34 +0300 Subject: [PATCH 3/5] [DE forms] Bug 54141 --- apps/common/forms/resources/less/common.less | 10 +++++++++- apps/documenteditor/forms/app/view/ApplicationView.js | 7 ++++++- apps/documenteditor/forms/locale/en.json | 4 +++- apps/documenteditor/forms/locale/ru.json | 4 +++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/common/forms/resources/less/common.less b/apps/common/forms/resources/less/common.less index b6f40bd3b..44e06dde8 100644 --- a/apps/common/forms/resources/less/common.less +++ b/apps/common/forms/resources/less/common.less @@ -436,7 +436,7 @@ .svg-icon { background: data-uri('../../../../common/forms/resources/img/icon-menu-sprite.svg') no-repeat; - background-size: @icon-width*22 @icon-height*2; + background-size: @icon-width*24 @icon-height*2; &.download { background-position: -@icon-width 0; @@ -512,6 +512,14 @@ background-position: -@icon-width*21 0; background-position: -@icon-width*21 @icon-normal-top; } + &.undo { + background-position: -@icon-width*22 0; + background-position: -@icon-width*22 @icon-normal-top; + } + &.redo { + background-position: -@icon-width*23 0; + background-position: -@icon-width*23 @icon-normal-top; + } } .btn { diff --git a/apps/documenteditor/forms/app/view/ApplicationView.js b/apps/documenteditor/forms/app/view/ApplicationView.js index 02303c67a..2c84b6dc1 100644 --- a/apps/documenteditor/forms/app/view/ApplicationView.js +++ b/apps/documenteditor/forms/app/view/ApplicationView.js @@ -91,6 +91,9 @@ define([ return new Common.UI.Menu({ cls: 'shifted-right', items: [ + { caption: this.textUndo, value: 'undo', iconCls: 'mi-icon svg-icon undo' }, + { caption: this.textRedo, value: 'redo', iconCls: 'mi-icon svg-icon redo' }, + { caption: '--' }, { caption: this.textCut, value: 'cut', iconCls: 'mi-icon svg-icon cut' }, { caption: this.textCopy, value: 'copy', iconCls: 'mi-icon svg-icon copy' }, { caption: this.textPaste, value: 'paste', iconCls: 'mi-icon svg-icon paste' } @@ -114,7 +117,9 @@ define([ textCopy: 'Copy', textPaste: 'Paste', textPrintSel: 'Print Selection', - txtDarkMode: 'Dark mode' + txtDarkMode: 'Dark mode', + textUndo: 'Undo', + textRedo: 'Redo' }, DE.Views.ApplicationView || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/forms/locale/en.json b/apps/documenteditor/forms/locale/en.json index 08910c316..fe47a8604 100644 --- a/apps/documenteditor/forms/locale/en.json +++ b/apps/documenteditor/forms/locale/en.json @@ -132,5 +132,7 @@ "DE.Views.ApplicationView.txtFullScreen": "Full Screen", "DE.Views.ApplicationView.txtPrint": "Print", "DE.Views.ApplicationView.txtShare": "Share", - "DE.Views.ApplicationView.txtTheme": "Interface theme" + "DE.Views.ApplicationView.txtTheme": "Interface theme", + "DE.Views.ApplicationView.textUndo": "Undo", + "DE.Views.ApplicationView.textRedo": "Redo" } \ No newline at end of file diff --git a/apps/documenteditor/forms/locale/ru.json b/apps/documenteditor/forms/locale/ru.json index f91f3872d..72f9d36a5 100644 --- a/apps/documenteditor/forms/locale/ru.json +++ b/apps/documenteditor/forms/locale/ru.json @@ -131,5 +131,7 @@ "DE.Views.ApplicationView.txtFullScreen": "Во весь экран", "DE.Views.ApplicationView.txtPrint": "Печать", "DE.Views.ApplicationView.txtShare": "Поделиться", - "DE.Views.ApplicationView.txtTheme": "Тема интерфейса" + "DE.Views.ApplicationView.txtTheme": "Тема интерфейса", + "DE.Views.ApplicationView.textUndo": "Отменить", + "DE.Views.ApplicationView.textRedo": "Повторить" } \ No newline at end of file From 424e094be7b94cd9bd56ae0774f4791a73747e32 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 29 Nov 2021 19:39:24 +0300 Subject: [PATCH 4/5] [DE forms] Bug Bug 54141 --- .../forms/app/controller/ApplicationController.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index f2e5d6099..132591f1c 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -1573,9 +1573,12 @@ define([ var cancopy = this.api.can_CopyCut(), disabled = menu_props.paraProps && menu_props.paraProps.locked || menu_props.headerProps && menu_props.headerProps.locked || menu_props.imgProps && (menu_props.imgProps.locked || menu_props.imgProps.content_locked); - this.textMenu.items[0].setDisabled(!cancopy); // copy - this.textMenu.items[1].setDisabled(disabled || !cancopy); // cut - this.textMenu.items[2].setDisabled(disabled) // paste; + this.textMenu.items[0].setDisabled(disabled || !this.api.asc_getCanUndo()); // undo + this.textMenu.items[1].setDisabled(disabled || !this.api.asc_getCanRedo()); // redo + + this.textMenu.items[3].setDisabled(!cancopy); // copy + this.textMenu.items[4].setDisabled(disabled || !cancopy); // cut + this.textMenu.items[5].setDisabled(disabled) // paste; this.showPopupMenu(this.textMenu, {}, event); } @@ -1583,6 +1586,12 @@ define([ onContextMenuClick: function(menu, item, e) { switch (item.value) { + case 'undo': + this.api && this.api.Undo(); + break; + case 'redo': + this.api && this.api.Redo(); + break; case 'copy': case 'cut': case 'paste': From 494673798c6940a0c3128f68c91bc643bb7f12a0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 29 Nov 2021 19:48:09 +0300 Subject: [PATCH 5/5] [DE forms] Open forms mode for viewing forms (not embedded). Fix Bug 54203, Bug 53943 --- apps/api/documents/api.js | 16 ++++------------ .../app/controller/ApplicationController.js | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 8161860bf..a6f43cf64 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -875,18 +875,10 @@ path_type; path += app + "/"; - if (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') { - var canFillForms = !config.document.permissions - ? true : (config.document.permissions.fillForms===undefined) - ? (config.document.permissions.edit !== false) : config.document.permissions.fillForms; - path_type = (config.type === "mobile" || isSafari_mobile) - ? "mobile" : (config.type === "embedded" || !canFillForms || config.editorConfig.mode === 'view') - ? "embed" : "forms"; - } else { - path_type = (config.type === "mobile" || isSafari_mobile) - ? "mobile" : (config.type === "embedded") - ? "embed" : "main"; - } + path_type = (config.type === "mobile" || isSafari_mobile) + ? "mobile" : (config.type === "embedded") + ? "embed" : (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') + ? "forms" : "main"; path += path_type; var index = "/index.html"; diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 132591f1c..ccd5696ef 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -489,7 +489,8 @@ define([ this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm; var type = /^(?:(oform))$/.exec(this.document.fileType); // can fill forms only in oform format - this.appOptions.canFillForms = this.appOptions.canLicense && !!(type && typeof type[1] === 'string') && ((this.permissions.fillForms===undefined) ? (this.permissions.edit !== false) : this.permissions.fillForms) && (this.editorConfig.mode !== 'view'); + this.appOptions.isOFORM = !!(type && typeof type[1] === 'string'); + this.appOptions.canFillForms = this.appOptions.canLicense && this.appOptions.isOFORM && ((this.permissions.fillForms===undefined) ? (this.permissions.edit !== false) : this.permissions.fillForms) && (this.editorConfig.mode !== 'view'); this.api.asc_setViewMode(!this.appOptions.canFillForms); this.appOptions.canBranding = params.asc_getCustomization(); @@ -1172,6 +1173,9 @@ define([ this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this)); this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this)); this.api.asc_SetHighlightRequiredFields(true); + Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); + Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage + Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); // set loaded image to control } if (this.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded @@ -1180,9 +1184,6 @@ define([ Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this)); Common.Gateway.on('downloadas', _.bind(this.onDownloadAs, this)); Common.Gateway.on('requestclose', _.bind(this.onRequestClose, this)); - Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); - Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage - Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); // set loaded image to control this.attachUIEvents(); @@ -1314,12 +1315,12 @@ define([ itemsCount--; } - if ( !this.embedConfig.saveUrl || !this.appOptions.canDownload || this.appOptions.canFillForms) { + if ( !this.embedConfig.saveUrl || !this.appOptions.canDownload || this.appOptions.isOFORM) { menuItems[2].setVisible(false); itemsCount--; } - if ( !this.appOptions.canFillForms || !this.appOptions.canDownload) { + if ( !this.appOptions.isOFORM || !this.appOptions.canDownload) { menuItems[3].setVisible(false); menuItems[4].setVisible(false); itemsCount -= 2; @@ -1355,7 +1356,7 @@ define([ Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this)); } - if ( !this.embedConfig.shareUrl || this.appOptions.canFillForms) { + if ( !this.embedConfig.shareUrl || this.appOptions.isOFORM) { menuItems[8].setVisible(false); itemsCount--; } @@ -1365,12 +1366,12 @@ define([ itemsCount--; } - if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) { + if ( !this.embedConfig.embedUrl || this.appOptions.isOFORM) { menuItems[11].setVisible(false); itemsCount--; } - if ( !this.embedConfig.fullscreenUrl ) { + if ( !this.embedConfig.fullscreenUrl || this.appOptions.isOFORM) { menuItems[12].setVisible(false); itemsCount--; }