From 1cc2ef2382ca19f3186106463b6c0b99f506f447 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 16 Jan 2024 20:37:44 +0300 Subject: [PATCH 01/63] Fix Bug 65875 --- apps/common/main/lib/controller/ReviewChanges.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 3efc27a61a..2535bd2da1 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -106,6 +106,7 @@ define([ this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : ''; this._state = { posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null, wsLock: false, wsProps: [], + displayMode: Asc.c_oAscDisplayModeInReview.Edit, disableEditing: false, // disable editing when disconnect/signed file/mail merge preview/review final or original/forms preview docProtection: { isReadOnly: false, @@ -251,7 +252,7 @@ define([ } if (this.getPopover()) { - if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0 && isShow) { // show changes balloon only for current position, not selection + if (!this.appConfig.reviewHoverMode && (this._state.displayMode !== Asc.c_oAscDisplayModeInReview.Simple) && sdkchange && sdkchange.length>0 && isShow) { // show changes balloon only for current position, not selection var i = 0, posX = sdkchange[0].get_X(), posY = sdkchange[0].get_Y(), @@ -832,6 +833,7 @@ define([ type = Asc.c_oAscDisplayModeInReview.Simple; break; } + this._state.displayMode = type; this.api.asc_SetDisplayModeInReview(type); } this.disableEditing(mode == 'final' || mode == 'original'); @@ -840,6 +842,7 @@ define([ onChangeDisplayModeInReview: function(type) { this.disableEditing(type===Asc.c_oAscDisplayModeInReview.Final || type===Asc.c_oAscDisplayModeInReview.Original); + this._state.displayMode = type; var mode = 'markup'; switch (type) { case Asc.c_oAscDisplayModeInReview.Final: From 1f99225d31de422f9cc6a0d8323cf794cc88ba5b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 6 Feb 2024 21:57:42 +0300 Subject: [PATCH 02/63] [DE] Move mail merge and color scheme buttons --- apps/api/documents/api.js | 6 ++- .../main/lib/controller/ReviewChanges.js | 10 ++++ apps/common/main/lib/view/ReviewChanges.js | 48 ++++++++++++++++++- .../main/app/controller/Main.js | 14 +++++- .../main/app/controller/Toolbar.js | 21 +++----- .../main/app/template/Toolbar.template | 6 ++- apps/documenteditor/main/app/view/Toolbar.js | 35 ++++---------- 7 files changed, 91 insertions(+), 49 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index d61245c723..b058dc2100 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -158,11 +158,13 @@ save: false/true // save button } / false / true, home: { - mailmerge: false/true // mail merge button + mailmerge: false/true // mail merge button // deprecated, button is moved to collaboration tab. use toolbar->collaboration->mailmerge instead }, layout: false / true, // layout tab references: false / true, // de references tab - collaboration: false / true // collaboration tab + collaboration: { + mailmerge: false/true // mail merge button in de + } / false / true, // collaboration tab draw: false / true // draw tab protect: false / true, // protect tab plugins: false / true // plugins tab diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 057a86f08b..36839c7e3c 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -1000,6 +1000,11 @@ define([ Common.Utils.InternalSettings.set(me.appPrefix + "settings-review-hover-mode", val); me.appConfig.reviewHoverMode = val; + if (me.view && me.view.btnMailRecepients) { + Common.Utils.lockControls(Common.enumLock.mmergeLock, !!me._state.mmdisable, {array: [me.view.btnMailRecepients]}); + me.view.mnuMailRecepients.items[2].setVisible(me.appConfig.fileChoiceUrl || me.appConfig.canRequestSelectSpreadsheet || me.appConfig.canRequestMailMergeRecipients); + } + me.view && me.view.onAppReady(config); }); }, @@ -1155,6 +1160,11 @@ define([ } }, + DisableMailMerge: function() { + this._state.mmdisable = true; + this.view && this.view.btnMailRecepients && Common.Utils.lockControls(Common.enumLock.mmergeLock, true, {array: [this.view.btnMailRecepients]}); + }, + textInserted: 'Inserted:', textDeleted: 'Deleted:', textParaInserted: 'Paragraph Inserted ', diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index dab7de765d..53d4ec51e4 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -112,6 +112,10 @@ define([ '
' + '' + '
' + + '
' + + '
' + + '' + + '
' + ''; function setEvents() { @@ -247,6 +251,11 @@ define([ me.fireEvent('comment:resolveComments', [item.value]); }); } + + this.mnuMailRecepients && this.mnuMailRecepients.on('item:click', function(menu, item, e) { + me.fireEvent('collaboration:mailmerge', [item.value]); + }); + Common.NotificationCenter.on('protect:doclock', function (e) { me.fireEvent('protect:update'); }); @@ -494,6 +503,28 @@ define([ }); this.lockedControls.push(this.btnCommentResolve); } + + if (this.appConfig.isEdit && this.appConfig.canCoAuthoring && this.appConfig.canUseMailMerge) { + this.btnMailRecepients = new Common.UI.Button({ + id: 'id-toolbar-btn-mailrecepients', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-mailmerge', + lock: [_set.mmergeLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.viewMode], + caption: this.txtMailMerge, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small', + menu: new Common.UI.Menu({ + items: [ + {caption: this.mniMMFromFile, value: 'file'}, + {caption: this.mniMMFromUrl, value: 'url'}, + {caption: this.mniMMFromStorage, value: 'storage'} + ] + }) + }); + this.mnuMailRecepients = this.btnMailRecepients.menu; + this.lockedControls.push(this.btnMailRecepients); + } }, render: function (el) { @@ -621,6 +652,7 @@ define([ me.btnSharing && me.btnSharing.updateHint(me.tipSharing); me.btnHistory && me.btnHistory.updateHint(me.tipHistory); me.btnChat && me.btnChat.updateHint(me.txtChat + Common.Utils.String.platformKey('Alt+Q', ' (' + (Common.Utils.isMac ? Common.Utils.String.textCtrl + '+' : '') + '{0})')); + me.btnMailRecepients && me.btnMailRecepients.updateHint(me.tipMailRecepients); if (me.btnCoAuthMode) { me.btnCoAuthMode.setMenu( new Common.UI.Menu({ @@ -700,6 +732,7 @@ define([ separator_review = !(config.canReview || config.canViewReview) ? me.$el.find('.separator.review') : '.separator.review', separator_compare = !(config.canReview && config.canFeatureComparison) ? me.$el.find('.separator.compare') : '.separator.compare', separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat', + separator_history = !me.btnHistory ? me.$el.find('.separator.history') : '.separator.history', separator_last; if (typeof separator_sharing == 'object') @@ -727,7 +760,12 @@ define([ else separator_last = separator_chat; - if (!me.btnHistory && separator_last) + if (typeof separator_history == 'object') + separator_history.hide().prev('.group').hide(); + else + separator_last = separator_history; + + if ((!me.btnMailRecepients || !Common.UI.LayoutManager.isElementVisible('toolbar-collaboration-mailmerge')) && separator_last) me.$el.find(separator_last).hide(); Common.NotificationCenter.trigger('tab:visible', 'review', (config.isEdit || config.canViewReview || me.canComments) && Common.UI.LayoutManager.isElementVisible('toolbar-collaboration')); @@ -755,6 +793,7 @@ define([ this.btnChat && this.btnChat.render(this.$el.find('#slot-btn-chat')); this.btnCommentRemove && this.btnCommentRemove.render(this.$el.find('#slot-comment-remove')); this.btnCommentResolve && this.btnCommentResolve.render(this.$el.find('#slot-comment-resolve')); + this.btnMailRecepients && this.btnMailRecepients.render(this.$el.find('#slot-btn-mailrecepients')); return this.$el; }, @@ -981,7 +1020,12 @@ define([ txtMarkupSimpleCap: 'Simple Markup', txtMarkupSimple: 'All changes {0}
Turn off balloons', txtEditing: 'Editing', - txtPreview: 'Preview' + txtPreview: 'Preview', + txtMailMerge: 'Mail Merge', + mniMMFromFile: 'From File', + mniMMFromUrl: 'From URL', + mniMMFromStorage: 'From Storage', + tipMailRecepients: 'Mail Merge', } }()), Common.Views.ReviewChanges || {})); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index b8373c6b23..44be3ed71f 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -2369,6 +2369,16 @@ define([ Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements); if (this.appOptions.canBrandingExt) { Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationExtElements); + if (this.appOptions.customization && this.appOptions.customization.layout && this.appOptions.customization.layout.toolbar && (typeof this.appOptions.customization.layout.toolbar === 'object') && + this.appOptions.customization.layout.toolbar.home && (typeof this.appOptions.customization.layout.toolbar.home === 'object') && this.appOptions.customization.layout.toolbar.home.mailmerge===false) { + console.log("Obsolete: The 'mailmerge' parameter of the 'customization.layout.toolbar.home' section is deprecated. Please use 'mailmerge' parameter in the 'customization.layout.toolbar.collaboration' section instead."); + if (this.appOptions.customization.layout.toolbar.collaboration!==false) { + if (typeof this.appOptions.customization.layout.toolbar.collaboration !== 'object') + this.appOptions.customization.layout.toolbar.collaboration = {}; + if (this.appOptions.customization.layout.toolbar.collaboration.mailmerge===undefined) + this.appOptions.customization.layout.toolbar.collaboration.mailmerge = this.appOptions.customization.layout.toolbar.home.mailmerge; + } + } Common.UI.LayoutManager.applyCustomization(); if (this.appOptions.customization && (typeof (this.appOptions.customization) == 'object')) { if (this.appOptions.customization.leftMenu!==undefined) @@ -2868,8 +2878,8 @@ define([ DisableMailMerge: function() { this.appOptions.mergeFolderUrl = ""; - var toolbarController = this.getApplication().getController('Toolbar'); - toolbarController && toolbarController.DisableMailMerge(); + var reivewController = this.getApplication().getController('Common.Controllers.ReviewChanges'); + reivewController && reivewController.DisableMailMerge(); }, DisableVersionHistory: function() { diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 1d1847acb6..7dc35b34ae 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -186,6 +186,9 @@ define([ }, 'DocumentHolder': { 'list:settings': this.onMarkerSettingsClick.bind(this) + }, + 'Common.Views.ReviewChanges': { + 'collaboration:mailmerge': _.bind(this.onSelectRecepientsClick, this) } }); @@ -367,7 +370,6 @@ define([ toolbar.mnuPageSize.on('item:click', _.bind(this.onPageSizeClick, this)); toolbar.mnuColorSchema.on('item:click', _.bind(this.onColorSchemaClick, this)); toolbar.mnuColorSchema.on('show:after', _.bind(this.onColorSchemaShow, this)); - toolbar.mnuMailRecepients.on('item:click', _.bind(this.onSelectRecepientsClick, this)); toolbar.mnuPageNumberPosPicker.on('item:click', _.bind(this.onInsertPageNumberClick, this)); toolbar.btnEditHeader.menu.on('item:click', _.bind(this.onEditHeaderFooterClick, this)); toolbar.btnInsDateTime.on('click', _.bind(this.onInsDateTimeClick, this)); @@ -3103,21 +3105,12 @@ 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.lockToolbar(Common.enumLock.mmergeLock, !!this._state.mmdisable, {array: [this.toolbar.btnMailRecepients]}); - if (!this._state.mmdisable) { - this.toolbar.mnuMailRecepients.items[2].setVisible(this.toolbar.mode.fileChoiceUrl || this.toolbar.mode.canRequestSelectSpreadsheet || this.toolbar.mode.canRequestMailMergeRecipients); - } this._state.activated = true; var props = this.api.asc_GetSectionProps(); this.onApiPageSize(props.get_W(), props.get_H()); }, - DisableMailMerge: function() { - this._state.mmdisable = true; - this.toolbar && this.toolbar.btnMailRecepients && this.toolbar.lockToolbar(Common.enumLock.mmergeLock, true, {array: [this.toolbar.btnMailRecepients]}); - }, - updateThemeColors: function() { var updateColors = function(picker, defaultColorIndex) { if (picker) { @@ -3311,13 +3304,13 @@ define([ disable ? Common.util.Shortcuts.suspendEvents(hkComments) : Common.util.Shortcuts.resumeEvents(hkComments); }, - onSelectRecepientsClick: function(menu, item, e) { + onSelectRecepientsClick: function(type) { if (this._mailMergeDlg) return; var me = this; - if (item.value === 'file') { + if (type === 'file') { this.api && this.api.asc_StartMailMerge(); - } else if (item.value === 'url') { + } else if (type === 'url') { (new Common.Views.ImageFromUrlDialog({ title: me.dataUrl, handler: function(result, value) { @@ -3337,7 +3330,7 @@ define([ } } })).show(); - } else if (item.value === 'storage') { + } else if (type === 'storage') { Common.NotificationCenter.trigger('storage:spreadsheet-load', 'mailmerge'); } }, diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index 87079162fe..9ae9091d8e 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -79,11 +79,9 @@
-
-
@@ -156,6 +154,10 @@
+
+
+ +
diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 4199ced018..f436cbd91c 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1377,36 +1377,20 @@ define([ this.btnColorSchemas = new Common.UI.Button({ id: 'id-toolbar-btn-colorschemas', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-colorschemas', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-big-colorschemas', lock: [_set.docSchemaLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.viewMode], + caption: me.capColorScheme, menu: new Common.UI.Menu({ cls: 'shifted-left', items: [], restoreHeight: true }), dataHint: '1', - dataHintDirection: 'top', - dataHintOffset: '0, -6' - }); - this.toolbarControls.push(this.btnColorSchemas); - - this.btnMailRecepients = new Common.UI.Button({ - id: 'id-toolbar-btn-mailrecepients', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-mailmerge', - lock: [_set.mmergeLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.viewMode], - dataHint: '1', dataHintDirection: 'bottom', - menu: new Common.UI.Menu({ - items: [ - {caption: this.mniFromFile, value: 'file'}, - {caption: this.mniFromUrl, value: 'url'}, - {caption: this.mniFromStorage, value: 'storage'} - ] - }) + dataHintOffset: 'small' }); - this.toolbarControls.push(this.btnMailRecepients); + this.toolbarControls.push(this.btnColorSchemas); me.btnImgAlign = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', @@ -1499,7 +1483,6 @@ define([ this.mnuPageSize = this.btnPageSize.menu; this.mnuColorSchema = this.btnColorSchemas.menu; this.mnuChangeCase = this.btnChangeCase.menu; - this.mnuMailRecepients = this.btnMailRecepients.menu; this.cmbFontSize = new Common.UI.ComboBox({ cls: 'input-group-nr', @@ -1779,7 +1762,6 @@ define([ _injectComponent('#slot-btn-colorschemas', this.btnColorSchemas); _injectComponent('#slot-btn-paracolor', this.btnParagraphColor); _injectComponent('#slot-field-styles', this.listStyles); - _injectComponent('#slot-btn-mailrecepients', this.btnMailRecepients); _injectComponent('#slot-img-align', this.btnImgAlign); _injectComponent('#slot-img-group', this.btnImgGroup); _injectComponent('#slot-img-movefrwd', this.btnImgForward); @@ -2171,7 +2153,6 @@ define([ this.btnClearStyle.updateHint(this.tipClearStyle); this.btnCopyStyle.updateHint(this.tipCopyStyle + Common.Utils.String.platformKey('Alt+Ctrl+C')); this.btnColorSchemas.updateHint(this.tipColorSchemas); - this.btnMailRecepients.updateHint(this.tipMailRecepients); this.btnHyphenation.updateHint(this.tipHyphenation); // set menus @@ -2845,7 +2826,6 @@ define([ this.mode = mode; - this.btnMailRecepients.setVisible(mode.canCoAuthoring == true && mode.canUseMailMerge); this.listStylesAdditionalMenuItem.setVisible(mode.canEditStyles); this.btnContentControls.menu.items[10].setVisible(mode.canEditContentControl); this.mnuInsertImage.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); @@ -3220,7 +3200,6 @@ define([ textEvenPage: 'Even Page', textOddPage: 'Odd Page', tipSaveCoauth: 'Save your changes for the other users to see them.', - tipMailRecepients: 'Mail Merge', textStyleMenuUpdate: 'Update from select', textStyleMenuRestore: 'Restore to default', textStyleMenuDelete: 'Delete style', @@ -3406,7 +3385,9 @@ define([ capBtnHyphenation: 'Hyphenation', textAuto: 'Automatic', textCustomHyphen: 'Hyphenation options', - tipHyphenation: 'Change hyphenation' + tipHyphenation: 'Change hyphenation', + capColorScheme: 'Color Scheme', + } })(), DE.Views.Toolbar || {})); }); From 5567a95bce5eafdcd786283abb7f338b6815b500 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 7 Feb 2024 11:23:02 +0300 Subject: [PATCH 03/63] Refactoring layout --- .../main/app/template/Toolbar.template | 14 +++++++------- apps/documenteditor/main/index.html | 6 +++--- apps/documenteditor/main/index.html.deploy | 4 ++-- .../main/resources/less/toolbar.less | 2 +- .../main/app/template/Toolbar.template | 15 +++++++++++---- .../main/resources/less/toolbar.less | 2 +- .../main/app/template/Toolbar.template | 13 ++++++++++--- 7 files changed, 35 insertions(+), 21 deletions(-) diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index 9ae9091d8e..0bacc61708 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -30,7 +30,7 @@
- +
@@ -38,7 +38,7 @@
-
+
@@ -54,6 +54,7 @@ +
@@ -75,17 +76,16 @@
-
+ +
- +
- +
- -
diff --git a/apps/documenteditor/main/index.html b/apps/documenteditor/main/index.html index fcf7ffee6e..7224d2465c 100644 --- a/apps/documenteditor/main/index.html +++ b/apps/documenteditor/main/index.html @@ -139,7 +139,7 @@ right: 0; top: 0; bottom: 0; - left: 587px; + left: 522px; width: inherit; height: 44px; } @@ -272,8 +272,8 @@