[SSE] Fix spell checking settings

This commit is contained in:
Julia Svinareva 2019-11-29 16:57:42 +03:00
parent ce13b3e4a8
commit d4e5451c70
3 changed files with 25 additions and 16 deletions

View file

@ -75,6 +75,7 @@ define([
'saveas:format': _.bind(this.clickSaveAsFormat, this), 'saveas:format': _.bind(this.clickSaveAsFormat, this),
'savecopy:format': _.bind(this.clickSaveCopyAsFormat, this), 'savecopy:format': _.bind(this.clickSaveCopyAsFormat, this),
'settings:apply': _.bind(this.applySettings, this), 'settings:apply': _.bind(this.applySettings, this),
'spellcheck:apply': _.bind(this.applySpellcheckSettings, this),
'create:new': _.bind(this.onCreateNew, this), 'create:new': _.bind(this.onCreateNew, this),
'recent:open': _.bind(this.onOpenRecent, this) 'recent:open': _.bind(this.onOpenRecent, this)
}, },
@ -394,6 +395,23 @@ define([
this.leftMenu.fireEvent('settings:apply'); this.leftMenu.fireEvent('settings:apply');
}, },
applySpellcheckSettings: function(menu) {
if (this.mode.isEdit && this.api) {
var value = Common.localStorage.getBool("sse-spellcheck-ignore-uppercase-words");
this.api.asc_ignoreUppercase(value);
value = Common.localStorage.getBool("sse-spellcheck-ignore-numbers-words");
this.api.asc_ignoreNumbers(value);
value = Common.localStorage.getItem("sse-spellcheck-locale");
if (value) {
this.api.asc_setDefaultLanguage(parseInt(value));
}
}
menu.hide();
this.leftMenu.fireEvent('spellcheck:update');
},
onCreateNew: function(menu, type) { onCreateNew: function(menu, type) {
if ( !Common.Controllers.Desktop.process('create:new') ) { if ( !Common.Controllers.Desktop.process('create:new') ) {
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");

View file

@ -93,8 +93,7 @@ define([
initialize: function() { initialize: function() {
this.addListeners({ this.addListeners({
'FileMenu': { 'FileMenu': {
'settings:apply': _.bind(this.applySettings, this), 'settings:apply': _.bind(this.applySettings, this)
'spellcheck:apply': _.bind(this.applySpellcheckSettings, this)
}, },
'Common.Views.ReviewChanges': { 'Common.Views.ReviewChanges': {
'settings:apply': _.bind(this.applySettings, this) 'settings:apply': _.bind(this.applySettings, this)
@ -2050,19 +2049,6 @@ define([
} }
}, },
applySpellcheckSettings: function() {
if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring && this.api) {
var value = Common.localStorage.getBool("sse-spellcheck-ignore-uppercase-words");
this.api.asc_ignoreUppercase(value);
value = Common.localStorage.getBool("sse-spellcheck-ignore-numbers-words");
this.api.asc_ignoreNumbers(value);
value = Common.localStorage.getItem("sse-spellcheck-locale");
if (value) {
this.api.asc_setDefaultLanguage(parseInt(value));
}
}
},
onDocumentName: function(name) { onDocumentName: function(name) {
this.headerView.setDocumentCaption(name); this.headerView.setDocumentCaption(name);
this.updateWindowTitle(this.api.asc_isDocumentModified(), true); this.updateWindowTitle(this.api.asc_isDocumentModified(), true);

View file

@ -61,7 +61,12 @@ define([
'hide': function() { 'hide': function() {
me.api && me.api.asc_cancelSpellCheck(); me.api && me.api.asc_cancelSpellCheck();
} }
} },
'LeftMenu': {
'spellcheck:update': function () {
me.updateLanguages();
}
},
}); });
}, },