From 2ffcc4b7176ac87bc6310a5cf0d15f83ce7af3e9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 3 Jun 2020 20:49:54 +0300 Subject: [PATCH] [SSE] Add settings for copy, cut, paste --- .../main/app/controller/LeftMenu.js | 4 ++++ .../main/app/controller/Main.js | 5 +++++ .../main/app/view/FileMenuPanels.js | 17 ++++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index cb30a47fd..523c0001a 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -389,6 +389,10 @@ define([ value = parseInt(Common.localStorage.getItem("sse-settings-autosave")); Common.Utils.InternalSettings.set("sse-settings-autosave", value); this.api.asc_setAutoSaveGap(value); + + value = parseInt(Common.localStorage.getItem("sse-settings-paste-button")); + Common.Utils.InternalSettings.set("sse-settings-paste-button", value); + this.api.asc_setVisiblePasteButton(!!value); } var reg = Common.localStorage.getItem("sse-settings-reg-settings"), diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 01212cb3b..a381e2ea0 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -808,6 +808,11 @@ define([ me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); } + value = Common.localStorage.getItem("sse-settings-paste-button"); + if (value===null) value = '1'; + Common.Utils.InternalSettings.set("sse-settings-paste-button", parseInt(value)); + me.api.asc_setVisiblePasteButton(!!parseInt(value)); + if (me.needToUpdateVersion) { Common.NotificationCenter.trigger('api:disconnect'); toolbarController.onApiCoAuthoringDisconnect(); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 848719a1b..c1e60b1e8 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -667,6 +667,10 @@ define([ '', '
', '','', + '', + '', + '
', + '','', '', '', '', @@ -918,6 +922,11 @@ define([ }); this.lblMacrosDesc = $markup.findById('#fms-lbl-macros'); + this.chPaste = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-paste-settings'), + labelText: this.strPasteButton + }); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -1042,6 +1051,8 @@ define([ item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("sse-macros-mode")}); this.cmbMacros.setValue(item ? item.get('value') : 0); this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); + + this.chPaste.setValue(Common.Utils.InternalSettings.get("sse-settings-paste-button")); }, applySettings: function() { @@ -1085,6 +1096,8 @@ define([ Common.localStorage.setItem("sse-macros-mode", this.cmbMacros.getValue()); Common.Utils.InternalSettings.set("sse-macros-mode", Common.localStorage.getItem("sse-macros-mode")); + Common.localStorage.setItem("sse-settings-paste-button", this.chPaste.isChecked() ? 1 : 0); + Common.localStorage.save(); if (this.menu) { this.menu.fireEvent('settings:apply', [this.menu]); @@ -1186,7 +1199,9 @@ define([ txtStopMacros: 'Disable All', txtWarnMacrosDesc: 'Disable all macros with notification', txtRunMacrosDesc: 'Enable all macros without notification', - txtStopMacrosDesc: 'Disable all macros without notification' + txtStopMacrosDesc: 'Disable all macros without notification', + strPaste: 'Cut, copy and paste', + strPasteButton: 'Show Paste Option button when content is pasted' }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); SSE.Views.FileMenuPanels.MainSpellCheckSettings = Common.UI.BaseView.extend(_.extend({ diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 54f5f6f48..82fbd0b51 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1699,6 +1699,8 @@ "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWarnMacrosDesc": "Disable all macros with notification", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRunMacrosDesc": "Enable all macros without notification", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtStopMacrosDesc": "Disable all macros without notification", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.strPaste": "Cut, copy and paste", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.strPasteButton": "Show Paste Option button when content is pasted", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.okButtonText": "Apply", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strDictionaryLanguage": "Dictionary language", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strIgnoreWordsInUPPERCASE": "Ignore words in UPPERCASE",