Skip to content

Commit

Permalink
Merge pull request 'fix/bug-72534' (#264) from fix/bug-72534 into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
Julia Radzhabova committed Jan 30, 2025
2 parents 92cca2a + f2da702 commit cdba289
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 64 deletions.
3 changes: 2 additions & 1 deletion apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', // <coauthoring mode>, 'fast' or 'strict'. if 'fast' and 'customization.autosave'=false -> set 'customization.autosave'=true. 'fast' - default for editor
Expand Down
17 changes: 15 additions & 2 deletions apps/documenteditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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) {
Expand Down
32 changes: 32 additions & 0 deletions apps/documenteditor/main/app/view/FileMenuPanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ define([], function () {
'<td>',
'<div><div id="fms-cmb-macros"></div>',
'</tr>',
'<tr>',
'<td><label><%= scope.strFontSizeType %></label></td>',
'<td><span id="fms-cmb-font-size-type"></span></td>',
'</tr>',
'<tr class ="divider-group"></tr>',
'<tr class="fms-btn-apply">',
'<td style="padding-top:15px; padding-bottom: 15px;"><button class="btn normal dlg-btn primary" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.okButtonText %></button></td>',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -918,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) {
Expand Down Expand Up @@ -1011,6 +1034,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() {
Expand Down Expand Up @@ -1074,6 +1100,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) {
Expand Down
130 changes: 69 additions & 61 deletions apps/documenteditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions apps/documenteditor/main/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions apps/documenteditor/main/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "总是",
Expand Down

0 comments on commit cdba289

Please sign in to comment.