From e93fc362391a08f2d97bcf28bee069fc91d28009 Mon Sep 17 00:00:00 2001 From: "Julia.Svinareva" Date: Thu, 16 May 2024 21:54:38 +0300 Subject: [PATCH] [common] Bug 67305 --- apps/common/main/lib/controller/Plugins.js | 45 ++++++++++++++++++++- apps/documenteditor/main/locale/en.json | 4 ++ apps/presentationeditor/main/locale/en.json | 4 ++ apps/spreadsheeteditor/main/locale/en.json | 4 ++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index b8da7c4e19..1a93c26b61 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -116,12 +116,15 @@ define([ this.autostart = []; this.customPluginsDlg = []; + this.newInstalledBackgroundPlugins = []; + Common.Gateway.on('init', this.loadConfig.bind(this)); Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this)); Common.NotificationCenter.on('uitheme:changed', this.updatePluginsButtons.bind(this)); Common.NotificationCenter.on('window:resize', this.updatePluginsButtons.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('doc:mode-changed', this.onChangeDocMode.bind(this)); + Common.NotificationCenter.on('modal:close', this.onModalClose.bind(this)); }, loadConfig: function(data) { @@ -817,6 +820,7 @@ define([ }, parsePlugins: function(pluginsdata, uiCustomize, forceUpdate) { + this.newInstalledBackgroundPlugins.length = 0; var me = this; var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'), isEdit = me.appOptions.isEdit && !me.isPDFEditor, @@ -916,6 +920,12 @@ define([ tab: item.tab ? {action: item.tab.id, caption: ((typeof item.tab.text == 'object') ? item.tab.text[lang] || item.tab.text['en'] : item.tab.text) || ''} : undefined }; updatedItem ? updatedItem.set(props) : arr.push(new Common.Models.Plugin(props)); + if (!updatedItem && props.isBackgroundPlugin) { + me.newInstalledBackgroundPlugins.push({ + name: name, + guid: item.guid + }); + } } }); @@ -1259,7 +1269,40 @@ define([ if (!this.viewPlugins.customPluginPanels[frameId].openInsideMode(description, variation.url, frameId, guid)) this.api.asc_pluginButtonClick(-1, guid, frameId); - } + }, + + onModalClose: function () { + var plugins = this.newInstalledBackgroundPlugins; + if (plugins && plugins.length > 0) { + var text = plugins.length > 1 ? this.textPluginsSuccessfullyInstalled : + Common.Utils.String.format(this.textPluginSuccessfullyInstalled, plugins[0].name); + this.backgroundPluginsTip = new Common.UI.SynchronizeTip({ + extCls: 'colored', + placement: 'bottom', + target: this.viewPlugins.backgroundBtn.$el, + text: text, + showLink: true, + textLink: plugins.length > 1 ? this.textRunInstalledPlugins : this.textRunPlugin + }); + this.backgroundPluginsTip.on('dontshowclick', function() { + this.backgroundPluginsTip.hide(); + this.newInstalledBackgroundPlugins.forEach(_.bind(function (item) { + this.api.asc_pluginRun(item.guid, 0, ''); + }, this)); + this.newInstalledBackgroundPlugins.length = 0; + }, this); + this.backgroundPluginsTip.on('closeclick', function () { + this.backgroundPluginsTip.hide(); + this.newInstalledBackgroundPlugins.length = 0; + }, this); + this.backgroundPluginsTip.show(); + } + }, + + textRunPlugin: 'Run plugin', + textRunInstalledPlugins: 'Run installed plugins', + textPluginSuccessfullyInstalled: '{0} is successfully installed. You can access all background plugins here.', + textPluginsSuccessfullyInstalled: 'Plugins are successfully installed. You can access all background plugins here.' }, Common.Controllers.Plugins || {})); }); diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 7abe83156f..964d5627e8 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -85,6 +85,10 @@ "Common.Controllers.ReviewChanges.textUrl": "Paste a document URL", "Common.Controllers.ReviewChanges.textWidow": "Widow control", "Common.Controllers.ReviewChanges.textWord": "Word level", + "Common.Controllers.Plugins.textRunPlugin": "Run plugin", + "Common.Controllers.Plugins.textRunInstalledPlugins": "Run installed plugins", + "Common.Controllers.Plugins.textPluginSuccessfullyInstalled": "{0} is successfully installed. You can access all background plugins here.", + "Common.Controllers.Plugins.textPluginsSuccessfullyInstalled": "Plugins are successfully installed. You can access all background plugins here.", "Common.define.chartData.textArea": "Area", "Common.define.chartData.textAreaStacked": "Stacked area", "Common.define.chartData.textAreaStackedPer": "100% Stacked area", diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 84423fae1d..505286525c 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -11,6 +11,10 @@ "Common.Controllers.ExternalOleEditor.textClose": "Close", "Common.Controllers.ExternalOleEditor.warningText": "The object is disabled because it is being edited by another user.", "Common.Controllers.ExternalOleEditor.warningTitle": "Warning", + "Common.Controllers.Plugins.textRunPlugin": "Run plugin", + "Common.Controllers.Plugins.textRunInstalledPlugins": "Run installed plugins", + "Common.Controllers.Plugins.textPluginSuccessfullyInstalled": "{0} is successfully installed. You can access all background plugins here.", + "Common.Controllers.Plugins.textPluginsSuccessfullyInstalled": "Plugins are successfully installed. You can access all background plugins here.", "Common.define.chartData.textArea": "Area", "Common.define.chartData.textAreaStacked": "Stacked area", "Common.define.chartData.textAreaStackedPer": "100% Stacked area", diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index c38c838e4d..041be600da 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -5,6 +5,10 @@ "Common.Controllers.Desktop.hintBtnHome": "Show Main window", "Common.Controllers.Desktop.itemCreateFromTemplate": "Create from template", "Common.Controllers.History.notcriticalErrorTitle": "Warning", + "Common.Controllers.Plugins.textRunPlugin": "Run plugin", + "Common.Controllers.Plugins.textRunInstalledPlugins": "Run installed plugins", + "Common.Controllers.Plugins.textPluginSuccessfullyInstalled": "{0} is successfully installed. You can access all background plugins here.", + "Common.Controllers.Plugins.textPluginsSuccessfullyInstalled": "Plugins are successfully installed. You can access all background plugins here.", "Common.define.chartData.textArea": "Area", "Common.define.chartData.textAreaStacked": "Stacked area", "Common.define.chartData.textAreaStackedPer": "100% Stacked area",