From 8bc1b75bc5041e019830c3e65f33a5e8de663b9c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 29 Jan 2025 23:21:08 +0300 Subject: [PATCH 1/2] [DE] Bug 72534 --- apps/api/documents/api.js | 3 +- .../main/app/controller/Toolbar.js | 17 ++- .../main/app/view/FileMenuPanels.js | 29 ++++ apps/documenteditor/main/app/view/Toolbar.js | 130 ++++++++++-------- apps/documenteditor/main/locale/en.json | 3 + apps/documenteditor/main/locale/zh.json | 3 + 6 files changed, 121 insertions(+), 64 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index d692b270fb..5faf446d6e 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -258,7 +258,8 @@ submitForm: { visible: true/false (default: true) resultMessage: 'text'/''/null/undefined // if '' - don't show a message after submitting form, null/undefined - show the default message - } + }, + forceWesternFontSize: false/true // used only in the document editor with lang=zh, Chinese by default }, coEditing: { mode: 'fast', // , 'fast' or 'strict'. if 'fast' and 'customization.autosave'=false -> set 'customization.autosave'=true. 'fast' - default for editor diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index c49ac814fe..f9725ee89a 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -109,7 +109,8 @@ define([ }, 'FileMenu': { 'menu:hide': this.onFileMenu.bind(this, 'hide'), - 'menu:show': this.onFileMenu.bind(this, 'show') + 'menu:show': this.onFileMenu.bind(this, 'show'), + 'settings:apply': _.bind(this.applySettings, this) }, 'Common.Views.Header': { 'print': function (opts) { @@ -3671,7 +3672,7 @@ define([ var lang = config.lang ? config.lang.toLowerCase() : 'en', langPrefix = lang.split(/[\-_]/)[0]; if (langPrefix === 'zh' && lang !== 'zh-tw' && lang !== 'zh_tw') { - me._state.type_fontsize = 'string'; + me._state.type_fontsize = Common.Utils.InternalSettings.get("de-settings-western-font-size") ? 'number' : 'string'; } this.btnsComment = []; @@ -3918,6 +3919,18 @@ define([ } }, + applySettings: function() { + if (this.toolbar.cmbFontSize && Common.Utils.InternalSettings.get("de-settings-western-font-size")!==undefined) { + this.toolbar.cmbFontSize.setData(Common.Utils.InternalSettings.get("de-settings-western-font-size") ? this.toolbar._fontSizeWestern.concat(this.toolbar._fontSizeChinese) : + this.toolbar._fontSizeChinese.concat(this.toolbar._fontSizeWestern)); + this._state.type_fontsize = Common.Utils.InternalSettings.get("de-settings-western-font-size") ? 'number' : 'string'; + if (this._state.fontsize!==undefined) { + var oldval = this._state.fontsize; + this._state.fontsize = undefined; + this.onApiFontSize(parseFloat(oldval)); + } + } + }, onPluginToolbarMenu: function(data) { var api = this.api; this.toolbar && Array.prototype.push.apply(this.toolbar.lockControls, Common.UI.LayoutManager.addCustomControls(this.toolbar, data, function(guid, value, pressed) { diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 672b49246c..cfb34ff346 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -437,6 +437,10 @@ define([], function () { '', '
', '', + '', + '', + '', + '', '', '', '', @@ -763,6 +767,22 @@ define([], function () { dataHintOffset: 'big' }); + this.cmbFontSizeType = new Common.UI.ComboBox({ + el : $markup.find('#fms-cmb-font-size-type'), + style : 'width: 160px;', + editable : false, + restoreMenuHeightAndTop: true, + menuStyle : 'min-width:100%;', + cls : 'input-group-nr', + data : [ + { value: false, displayValue: this.strChinese }, + { value: true, displayValue: this.strWestern } + ], + dataHint: '2', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.chPaste = new Common.UI.CheckBox({ el: $markup.findById('#fms-chb-paste-settings'), labelText: this.strPasteButton, @@ -1011,6 +1031,9 @@ define([], function () { value = Common.Utils.InternalSettings.get("settings-tab-style"); item = this.cmbTabStyle.store.findWhere({value: value}); this.cmbTabStyle.setValue(item ? item.get('value') : 'fill'); + + if (Common.Utils.InternalSettings.get("de-settings-western-font-size")!==undefined) + this.cmbFontSizeType.setValue(Common.Utils.InternalSettings.get("de-settings-western-font-size")); }, applySettings: function() { @@ -1074,6 +1097,12 @@ define([], function () { Common.UI.TabStyler.setStyle(this.cmbTabStyle.getValue()); } + if (Common.Utils.InternalSettings.get("de-settings-western-font-size")!==undefined) { + var val = this.cmbFontSizeType.getValue(); + Common.localStorage.setBool("de-settings-western-font-size", val); + Common.Utils.InternalSettings.set("de-settings-western-font-size", val); + } + Common.localStorage.save(); if (this.menu) { diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index bd71d64022..51945a3af5 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -2160,67 +2160,75 @@ define([ me._isDocReady = true; if (me.cmbFontSize) { var lang = config.lang ? config.lang.toLowerCase() : 'en', - langPrefix = lang.split(/[\-_]/)[0]; - var fontSizeData = (langPrefix === 'zh' && lang !== 'zh-tw' && lang !== 'zh_tw') ? [ - {value: '42_str', displayValue: "初号"}, - {value: '36_str', displayValue: "小初"}, - {value: '26_str', displayValue: "一号"}, - {value: '24_str', displayValue: "小一"}, - {value: '22_str', displayValue: "二号"}, - {value: '18_str', displayValue: "小二"}, - {value: '16_str', displayValue: "三号"}, - {value: '15_str', displayValue: "小三"}, - {value: '14_str', displayValue: "四号"}, - {value: '12_str', displayValue: "小四"}, - {value: '10.5_str', displayValue: "五号"}, - {value: '9_str', displayValue: "小五"}, - {value: '7.5_str', displayValue: "六号"}, - {value: '6.5_str', displayValue: "小六"}, - {value: '5.5_str', displayValue: "七号"}, - {value: '5_str', displayValue: "八号"}, - {value: 5, displayValue: "5"}, - {value: 5.5, displayValue: "5.5"}, - {value: 6.5, displayValue: "6.5"}, - {value: 7.5, displayValue: "7.5"}, - {value: 8, displayValue: "8"}, - {value: 9, displayValue: "9"}, - {value: 10, displayValue: "10"}, - {value: 10.5, displayValue: "10.5"}, - {value: 11, displayValue: "11"}, - {value: 12, displayValue: "12"}, - {value: 14, displayValue: "14"}, - {value: 15, displayValue: "15"}, - {value: 16, displayValue: "16"}, - {value: 18, displayValue: "18"}, - {value: 20, displayValue: "20"}, - {value: 22, displayValue: "22"}, - {value: 24, displayValue: "24"}, - {value: 26, displayValue: "26"}, - {value: 28, displayValue: "28"}, - {value: 36, displayValue: "36"}, - {value: 42, displayValue: "42"}, - {value: 48, displayValue: "48"}, - {value: 72, displayValue: "72"}, - {value: 96, displayValue: "96"} - ] : [ - {value: 8, displayValue: "8"}, - {value: 9, displayValue: "9"}, - {value: 10, displayValue: "10"}, - {value: 11, displayValue: "11"}, - {value: 12, displayValue: "12"}, - {value: 14, displayValue: "14"}, - {value: 16, displayValue: "16"}, - {value: 18, displayValue: "18"}, - {value: 20, displayValue: "20"}, - {value: 22, displayValue: "22"}, - {value: 24, displayValue: "24"}, - {value: 26, displayValue: "26"}, - {value: 28, displayValue: "28"}, - {value: 36, displayValue: "36"}, - {value: 48, displayValue: "48"}, - {value: 72, displayValue: "72"}, - {value: 96, displayValue: "96"} - ]; + langPrefix = lang.split(/[\-_]/)[0], + fontSizeData = [ + {value: 8, displayValue: "8"}, + {value: 9, displayValue: "9"}, + {value: 10, displayValue: "10"}, + {value: 11, displayValue: "11"}, + {value: 12, displayValue: "12"}, + {value: 14, displayValue: "14"}, + {value: 16, displayValue: "16"}, + {value: 18, displayValue: "18"}, + {value: 20, displayValue: "20"}, + {value: 22, displayValue: "22"}, + {value: 24, displayValue: "24"}, + {value: 26, displayValue: "26"}, + {value: 28, displayValue: "28"}, + {value: 36, displayValue: "36"}, + {value: 48, displayValue: "48"}, + {value: 72, displayValue: "72"}, + {value: 96, displayValue: "96"} + ]; + + if (langPrefix === 'zh' && lang !== 'zh-tw' && lang !== 'zh_tw') { + Common.Utils.InternalSettings.set("de-settings-western-font-size", Common.localStorage.getBool("de-settings-western-font-size", !!config.customization && !!config.customization.forceWesternFontSize)); + me._fontSizeChinese = [ + {value: '42_str', displayValue: "初号"}, + {value: '36_str', displayValue: "小初"}, + {value: '26_str', displayValue: "一号"}, + {value: '24_str', displayValue: "小一"}, + {value: '22_str', displayValue: "二号"}, + {value: '18_str', displayValue: "小二"}, + {value: '16_str', displayValue: "三号"}, + {value: '15_str', displayValue: "小三"}, + {value: '14_str', displayValue: "四号"}, + {value: '12_str', displayValue: "小四"}, + {value: '10.5_str', displayValue: "五号"}, + {value: '9_str', displayValue: "小五"}, + {value: '7.5_str', displayValue: "六号"}, + {value: '6.5_str', displayValue: "小六"}, + {value: '5.5_str', displayValue: "七号"}, + {value: '5_str', displayValue: "八号"} + ]; + me._fontSizeWestern = [ + {value: 5, displayValue: "5"}, + {value: 5.5, displayValue: "5.5"}, + {value: 6.5, displayValue: "6.5"}, + {value: 7.5, displayValue: "7.5"}, + {value: 8, displayValue: "8"}, + {value: 9, displayValue: "9"}, + {value: 10, displayValue: "10"}, + {value: 10.5, displayValue: "10.5"}, + {value: 11, displayValue: "11"}, + {value: 12, displayValue: "12"}, + {value: 14, displayValue: "14"}, + {value: 15, displayValue: "15"}, + {value: 16, displayValue: "16"}, + {value: 18, displayValue: "18"}, + {value: 20, displayValue: "20"}, + {value: 22, displayValue: "22"}, + {value: 24, displayValue: "24"}, + {value: 26, displayValue: "26"}, + {value: 28, displayValue: "28"}, + {value: 36, displayValue: "36"}, + {value: 42, displayValue: "42"}, + {value: 48, displayValue: "48"}, + {value: 72, displayValue: "72"}, + {value: 96, displayValue: "96"} + ]; + fontSizeData = Common.Utils.InternalSettings.get("de-settings-western-font-size") ? me._fontSizeWestern.concat(me._fontSizeChinese) : me._fontSizeChinese.concat(me._fontSizeWestern); + } me.cmbFontSize.setData(fontSizeData); } (new Promise( function(resolve, reject) { diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 95e73d17d7..cf0700a0c3 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -2312,6 +2312,9 @@ "DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "DE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", + "DE.Views.FileMenuPanels.Settings.strFontSizeType": "Use first in the font size list", + "DE.Views.FileMenuPanels.Settings.strChinese": "Chinese", + "DE.Views.FileMenuPanels.Settings.strWestern": "Western", "DE.Views.FileMenuPanels.ViewSaveAs.textDownloadAs": "Download as", "DE.Views.FileMenuPanels.ViewSaveCopy.textSaveCopyAs": "Save copy as", "DE.Views.FormSettings.textAlways": "Always", diff --git a/apps/documenteditor/main/locale/zh.json b/apps/documenteditor/main/locale/zh.json index 8ec199a736..ed8eb85dd7 100644 --- a/apps/documenteditor/main/locale/zh.json +++ b/apps/documenteditor/main/locale/zh.json @@ -2311,6 +2311,9 @@ "DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "禁用全部宏,并显示通知", "DE.Views.FileMenuPanels.Settings.txtWin": "按照 Windows 样式", "DE.Views.FileMenuPanels.Settings.txtWorkspace": "工作区", + "DE.Views.FileMenuPanels.Settings.strFontSizeType": "Use first in the font size list", + "DE.Views.FileMenuPanels.Settings.strChinese": "Chinese", + "DE.Views.FileMenuPanels.Settings.strWestern": "Western", "DE.Views.FileMenuPanels.ViewSaveAs.textDownloadAs": "下载为", "DE.Views.FileMenuPanels.ViewSaveCopy.textSaveCopyAs": "另存副本为", "DE.Views.FormSettings.textAlways": "总是", From f2da702f2f3b64de347cb7f76c4564f6051fe99e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 29 Jan 2025 23:27:54 +0300 Subject: [PATCH 2/2] [DE] Bug 72534 --- apps/documenteditor/main/app/view/FileMenuPanels.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index cfb34ff346..5979268ef4 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -437,7 +437,7 @@ define([], function () { '', '
', '', - '', + '', '', '', '', @@ -938,6 +938,9 @@ define([], function () { if (mode.compactHeader) { $('tr.quick-access', this.el).hide(); } + + if (Common.Utils.InternalSettings.get("de-settings-western-font-size")===undefined && this.cmbFontSizeType.cmpEl) + this.cmbFontSizeType.cmpEl.closest('tr').hide(); }, setApi: function(o) {