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/common/forms/resources/img/icon-menu-sprite.svg b/apps/common/forms/resources/img/icon-menu-sprite.svg index bcb884c10..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,5 +172,17 @@ + + + + + + + + + + + + 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/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index f2e5d6099..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--; } @@ -1573,9 +1574,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 +1587,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': 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