From 0bdcd6099ffa3ea9aecf2cbf37aa5b24eac015d3 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 6 Oct 2017 13:57:35 +0300 Subject: [PATCH] Added Sogou Pinyin input in Chrome. --- .../main/app/controller/LeftMenu.js | 5 +++++ apps/documenteditor/main/app/controller/Main.js | 5 +++++ .../main/app/view/FileMenuPanels.js | 16 +++++++++++++++- apps/documenteditor/main/locale/en.json | 1 + .../main/app/controller/LeftMenu.js | 5 +++++ .../main/app/controller/Main.js | 5 +++++ .../main/app/view/FileMenuPanels.js | 16 +++++++++++++++- apps/presentationeditor/main/locale/en.json | 1 + .../main/app/controller/LeftMenu.js | 5 +++++ .../main/app/controller/Main.js | 5 +++++ .../main/app/view/FileMenuPanels.js | 17 ++++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 2 ++ 12 files changed, 80 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 31ecfc3e7..091e0a127 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -299,6 +299,11 @@ define([ var value; this.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode")); + if (Common.Utils.isChrome) { + value = Common.localStorage.getBool("de-settings-inputsogou"); + window["AscInputMethod"]["SogouPinyin"] = value; + } + /** coauthoring begin **/ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { var fast_coauth = Common.localStorage.getBool("de-settings-coauthmode", true); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 08dbddd8e..6e96e290f 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -800,6 +800,11 @@ define([ me.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode")); + if (Common.Utils.isChrome) { + value = Common.localStorage.getBool("de-settings-inputsogou"); + window["AscInputMethod"]["SogouPinyin"] = value; + } + /** coauthoring begin **/ if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { value = Common.localStorage.getItem("de-settings-coauthmode"); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index a2953db42..a43602008 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -128,6 +128,10 @@ define([ '', '
', '','', + '', + '', + '
', + '','', '', '', '', @@ -185,6 +189,11 @@ define([ labelText: this.strInputMode }); + this.chInputSogou = new Common.UI.CheckBox({ + el: $('#fms-chb-input-sogou'), + labelText: this.strInputSogou + }); + /** coauthoring begin **/ this.chLiveComment = new Common.UI.CheckBox({ el: $('#fms-chb-live-comment'), @@ -339,10 +348,13 @@ define([ $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring && mode.canComments ? 'show' : 'hide'](); /** coauthoring end **/ + + $('tr.sogou', this.el)[mode.isEdit && Common.Utils.isChrome ?'show':'hide'](); }, updateSettings: function() { this.chInputMode.setValue(Common.localStorage.getBool("de-settings-inputmode")); + Common.Utils.isChrome && this.chInputSogou.setValue(Common.localStorage.getBool("de-settings-inputsogou")); var value = Common.localStorage.getItem("de-settings-zoom"); value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : 100); @@ -393,6 +405,7 @@ define([ applySettings: function() { Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); + Common.Utils.isChrome && Common.localStorage.setItem("de-settings-inputsogou", this.chInputSogou.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue()); /** coauthoring begin **/ Common.localStorage.setItem("de-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0); @@ -470,7 +483,8 @@ define([ txtFitWidth: 'Fit to Width', textForceSave: 'Save to Server', strForcesave: 'Always save to server (otherwise save to server on document close)', - strResolvedComment: 'Turn on display of the resolved comments' + strResolvedComment: 'Turn on display of the resolved comments', + strInputSogou: 'Turn on Sogou Pinyin input' }, DE.Views.FileMenuPanels.Settings || {})); DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index f15a493ba..c8b492a0c 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -994,6 +994,7 @@ "DE.Views.FileMenuPanels.Settings.strFontRender": "Font Hinting", "DE.Views.FileMenuPanels.Settings.strForcesave": "Always save to server (otherwise save to server on document close)", "DE.Views.FileMenuPanels.Settings.strInputMode": "Turn on hieroglyphs", + "DE.Views.FileMenuPanels.Settings.strInputSogou": "Turn on Sogou Pinyin input", "DE.Views.FileMenuPanels.Settings.strLiveComment": "Turn on display of the comments", "DE.Views.FileMenuPanels.Settings.strResolvedComment": "Turn on display of the resolved comments", "DE.Views.FileMenuPanels.Settings.strShowChanges": "Realtime Collaboration Changes", diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index d41162cdd..7c8a0e8c8 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -240,6 +240,11 @@ define([ applySettings: function(menu) { this.api.SetTextBoxInputMode(Common.localStorage.getBool("pe-settings-inputmode")); + if (Common.Utils.isChrome) { + value = Common.localStorage.getBool("pe-settings-inputsogou"); + window["AscInputMethod"]["SogouPinyin"] = value; + } + /** coauthoring begin **/ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { this.api.asc_SetFastCollaborative(Common.localStorage.getBool("pe-settings-coauthmode", true)); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 9031b0b86..6e2d1d421 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -598,6 +598,11 @@ define([ me.api.SetTextBoxInputMode(Common.localStorage.getBool("pe-settings-inputmode")); + if (Common.Utils.isChrome) { + value = Common.localStorage.getBool("pe-settings-inputsogou"); + window["AscInputMethod"]["SogouPinyin"] = value; + } + /** coauthoring begin **/ if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { value = Common.localStorage.getItem("pe-settings-coauthmode"); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 75547a46d..919b9f72c 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -119,6 +119,10 @@ define([ '', '
', '','', + '', + '', + '
', + '','', '', '', '', @@ -173,6 +177,11 @@ define([ labelText: this.strInputMode }); + this.chInputSogou = new Common.UI.CheckBox({ + el: $('#fms-chb-input-sogou'), + labelText: this.strInputSogou + }); + this.cmbZoom = new Common.UI.ComboBox({ el : $('#fms-cmb-zoom'), style : 'width: 160px;', @@ -282,12 +291,15 @@ define([ /** coauthoring begin **/ $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); /** coauthoring end **/ + + $('tr.sogou', this.el)[mode.isEdit && Common.Utils.isChrome ?'show':'hide'](); }, updateSettings: function() { this.chSpell.setValue(Common.localStorage.getBool("pe-settings-spellcheck", true)); this.chInputMode.setValue(Common.localStorage.getBool("pe-settings-inputmode")); + Common.Utils.isChrome && this.chInputSogou.setValue(Common.localStorage.getBool("pe-settings-inputsogou")); var value = Common.localStorage.getItem("pe-settings-zoom"); value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : -1); @@ -326,6 +338,7 @@ define([ applySettings: function() { Common.localStorage.setItem("pe-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); + Common.Utils.isChrome && Common.localStorage.setItem("pe-settings-inputsogou", this.chInputSogou.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue()); /** coauthoring begin **/ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { @@ -376,7 +389,8 @@ define([ textForceSave: 'Save to Server', strForcesave: 'Always save to server (otherwise save to server on document close)', txtSpellCheck: 'Spell Checking', - strSpellCheckMode: 'Turn on spell checking option' + strSpellCheckMode: 'Turn on spell checking option', + strInputSogou: 'Turn on Sogou Pinyin input' }, PE.Views.FileMenuPanels.Settings || {})); PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index ef2ba3b31..03cfb7793 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -840,6 +840,7 @@ "PE.Views.FileMenuPanels.Settings.strFast": "Fast", "PE.Views.FileMenuPanels.Settings.strForcesave": "Always save to server (otherwise save to server on document close)", "PE.Views.FileMenuPanels.Settings.strInputMode": "Turn on hieroglyphs", + "PE.Views.FileMenuPanels.Settings.strInputSogou": "Turn on Sogou Pinyin input", "PE.Views.FileMenuPanels.Settings.strShowChanges": "Realtime Collaboration Changes", "PE.Views.FileMenuPanels.Settings.strSpellCheckMode": "Turn on spell checking option", "PE.Views.FileMenuPanels.Settings.strStrict": "Strict", diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 94cfd26db..5d2d000d9 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -264,6 +264,11 @@ define([ applySettings: function(menu) { this.api.asc_setFontRenderingMode(parseInt(Common.localStorage.getItem("sse-settings-fontrender"))); + if (Common.Utils.isChrome) { + value = Common.localStorage.getBool("sse-settings-inputsogou"); + window["AscInputMethod"]["SogouPinyin"] = value; + } + /** coauthoring begin **/ var value = Common.localStorage.getItem("sse-settings-livecomment"); var resolved = Common.localStorage.getItem("sse-settings-resolvedcomment"); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index e2998582b..72c3d3531 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -149,6 +149,11 @@ define([ }); this.api.asc_setFontRenderingMode(parseInt(value)); + if (Common.Utils.isChrome) { + value = Common.localStorage.getBool("sse-settings-inputsogou"); + window["AscInputMethod"]["SogouPinyin"] = value; + } + this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this)); this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this)); this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this)); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index b5143d50e..978af2c82 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -447,6 +447,10 @@ define([ '', '
', '','', + '', + '', + '
', + '','', '', '', '', @@ -515,6 +519,11 @@ define([ labelText: this.strResolvedComment }); + this.chInputSogou = new Common.UI.CheckBox({ + el: $('#fms-chb-input-sogou'), + labelText: this.strInputSogou + }); + this.cmbCoAuthMode = new Common.UI.ComboBox({ el : $('#fms-cmb-coauth-mode'), style : 'width: 160px;', @@ -679,6 +688,7 @@ define([ $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring && mode.canComments ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide'](); + $('tr.sogou', this.el)[mode.isEdit && Common.Utils.isChrome ?'show':'hide'](); }, setApi: function(api) { @@ -710,6 +720,8 @@ define([ /** coauthoring end **/ value = Common.localStorage.getItem("sse-settings-fontrender"); + Common.Utils.isChrome && this.chInputSogou.setValue(Common.localStorage.getBool("sse-settings-inputsogou")); + item = this.cmbFontRender.store.findWhere({value: parseInt(value)}); this.cmbFontRender.setValue(item ? item.get('value') : (window.devicePixelRatio > 1 ? Asc.c_oAscFontRenderingModeType.noHinting : Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling)); @@ -758,6 +770,7 @@ define([ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) Common.localStorage.setItem("sse-settings-coauthmode", this.cmbCoAuthMode.getValue()); /** coauthoring end **/ + Common.Utils.isChrome && Common.localStorage.setItem("sse-settings-inputsogou", this.chInputSogou.isChecked() ? 1 : 0); Common.localStorage.setItem("sse-settings-fontrender", this.cmbFontRender.getValue()); Common.localStorage.setItem("sse-settings-unit", this.cmbUnit.getValue()); Common.localStorage.setItem("sse-settings-autosave", this.chAutosave.isChecked() ? 1 : 0); @@ -838,7 +851,9 @@ define([ txtInch: 'Inch', textForceSave: 'Save to Server', strForcesave: 'Always save to server (otherwise save to server on document close)', - strResolvedComment: 'Turn on display of the resolved comments' + strResolvedComment: 'Turn on display of the resolved comments', + txtInput: 'Alternate Input', + strInputSogou: 'Turn on Sogou Pinyin input' }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 65b365378..6e66bb63b 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1100,6 +1100,7 @@ "SSE.Views.FileMenuPanels.MainSettingsGeneral.strForcesave": "Always save to server (otherwise save to server on document close)", "SSE.Views.FileMenuPanels.MainSettingsGeneral.strFuncLocale": "Formula Language", "SSE.Views.FileMenuPanels.MainSettingsGeneral.strFuncLocaleEx": "Example: SUM; MIN; MAX; COUNT", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.strInputSogou": "Turn on Sogou Pinyin input", "SSE.Views.FileMenuPanels.MainSettingsGeneral.strLiveComment": "Turn on display of the comments", "SSE.Views.FileMenuPanels.MainSettingsGeneral.strRegSettings": "Regional Settings", "SSE.Views.FileMenuPanels.MainSettingsGeneral.strRegSettingsEx": "Example: ", @@ -1120,6 +1121,7 @@ "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtDe": "Deutsch", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtEn": "English", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtInch": "Inch", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtInput": "Alternate Input", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtLiveComment": "Commenting Display", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtMac": "as OS X", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtNative": "Native",