[SSE] Use FeaturesManager for spellcheck customization.
This commit is contained in:
parent
fb66a79a0f
commit
bad734bf2d
|
@ -239,7 +239,7 @@ define([
|
|||
this.leftMenu.btnComments.hide();
|
||||
}
|
||||
|
||||
if (this.mode.isEdit) {
|
||||
if (this.mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck')) {
|
||||
Common.UI.LayoutManager.isElementVisible('leftMenu-spellcheck') && this.leftMenu.btnSpellcheck.show();
|
||||
this.leftMenu.setOptionsPanel('spellcheck', this.getApplication().getController('Spellcheck').getView('Spellcheck'));
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ define([
|
|||
},
|
||||
|
||||
applySpellcheckSettings: function(menu) {
|
||||
if (this.mode.isEdit && this.api) {
|
||||
if (this.mode.isEdit && this.api && Common.UI.FeaturesManager.canChange('spellcheck')) {
|
||||
var value = Common.localStorage.getBool("sse-spellcheck-ignore-uppercase-words");
|
||||
this.api.asc_ignoreUppercase(value);
|
||||
value = Common.localStorage.getBool("sse-spellcheck-ignore-numbers-words");
|
||||
|
|
|
@ -858,14 +858,17 @@ define([
|
|||
this.api.asc_setAutoSaveGap(Common.Utils.InternalSettings.get("sse-settings-autosave"));
|
||||
/** coauthoring end **/
|
||||
|
||||
/** spellcheck settings begin **/
|
||||
var ignoreUppercase = Common.localStorage.getBool("sse-spellcheck-ignore-uppercase-words", true);
|
||||
Common.Utils.InternalSettings.set("sse-spellcheck-ignore-uppercase-words", ignoreUppercase);
|
||||
this.api.asc_ignoreUppercase(ignoreUppercase);
|
||||
var ignoreNumbers = Common.localStorage.getBool("sse-spellcheck-ignore-numbers-words", true);
|
||||
Common.Utils.InternalSettings.set("sse-spellcheck-ignore-numbers-words", ignoreNumbers);
|
||||
this.api.asc_ignoreNumbers(ignoreNumbers);
|
||||
/** spellcheck settings end **/
|
||||
// spellcheck
|
||||
if (Common.UI.FeaturesManager.canChange('spellcheck')) { // get from local storage
|
||||
/** spellcheck settings begin **/
|
||||
var ignoreUppercase = Common.localStorage.getBool("sse-spellcheck-ignore-uppercase-words", true);
|
||||
Common.Utils.InternalSettings.set("sse-spellcheck-ignore-uppercase-words", ignoreUppercase);
|
||||
this.api.asc_ignoreUppercase(ignoreUppercase);
|
||||
var ignoreNumbers = Common.localStorage.getBool("sse-spellcheck-ignore-numbers-words", true);
|
||||
Common.Utils.InternalSettings.set("sse-spellcheck-ignore-numbers-words", ignoreNumbers);
|
||||
this.api.asc_ignoreNumbers(ignoreNumbers);
|
||||
/** spellcheck settings end **/
|
||||
}
|
||||
|
||||
me.api.asc_registerCallback('asc_onStartAction', _.bind(me.onLongActionBegin, me));
|
||||
me.api.asc_registerCallback('asc_onConfirmAction', _.bind(me.onConfirmAction, me));
|
||||
|
@ -917,7 +920,7 @@ define([
|
|||
this.formulaInput = celleditorController.getView('CellEditor').$el.find('textarea');
|
||||
|
||||
if (me.appOptions.isEdit) {
|
||||
spellcheckController.setApi(me.api).setMode(me.appOptions);
|
||||
Common.UI.FeaturesManager.canChange('spellcheck') && spellcheckController.setApi(me.api).setMode(me.appOptions);
|
||||
|
||||
if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true
|
||||
me.appOptions.forcesave = Common.localStorage.getBool("sse-settings-forcesave", me.appOptions.canForcesave);
|
||||
|
@ -1259,6 +1262,7 @@ define([
|
|||
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
|
||||
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);
|
||||
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout);
|
||||
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features);
|
||||
}
|
||||
|
||||
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline;
|
||||
|
|
|
@ -1491,18 +1491,18 @@ define([
|
|||
|
||||
template: _.template([
|
||||
'<table class="main" style="margin: 30px 0;"><tbody>',
|
||||
'<tr>',
|
||||
'<tr class="spellcheck">',
|
||||
'<td class="left" style="padding-bottom: 8px;"><label><%= scope.strDictionaryLanguage %></label></td>',
|
||||
'<td class="right" style="padding-bottom: 8px;"><span id="fms-cmb-dictionary-language"></span></td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<tr class="spellcheck">',
|
||||
'<td class="left" style="padding-bottom: 8px;"></td>',
|
||||
'<td class="right" style="padding-bottom: 8px;"><span id="fms-chb-ignore-uppercase-words"></span></td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<tr class="spellcheck">',
|
||||
'<td class="left"></td>',
|
||||
'<td class="right"><span id="fms-chb-ignore-numbers-words"></span></td>',
|
||||
'</tr>','<tr class="divider"></tr>',
|
||||
'</tr>','<tr class="divider spellcheck"></tr>',
|
||||
'<tr>',
|
||||
'<td class="left"><label><%= scope.txtProofing %></label></td>',
|
||||
'<td class="right"><button type="button" class="btn btn-text-default" id="fms-btn-auto-correct" style="width:auto; display: inline-block;padding-right: 10px;padding-left: 10px;" data-hint="3" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtAutoCorrect %></button></div></td>',
|
||||
|
@ -1584,6 +1584,7 @@ define([
|
|||
|
||||
setMode: function(mode) {
|
||||
this.mode = mode;
|
||||
$('tr.spellcheck', this.el)[Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide']();
|
||||
},
|
||||
|
||||
setApi: function(api) {
|
||||
|
@ -1591,6 +1592,8 @@ define([
|
|||
},
|
||||
|
||||
updateSettings: function() {
|
||||
if (!Common.UI.FeaturesManager.canChange('spellcheck')) return;
|
||||
|
||||
var arrLang = SSE.getController('Spellcheck').loadLanguages(),
|
||||
allLangs = arrLang[0],
|
||||
langs = arrLang[1],
|
||||
|
@ -1627,6 +1630,8 @@ define([
|
|||
},
|
||||
|
||||
applySettings: function() {
|
||||
if (!Common.UI.FeaturesManager.canChange('spellcheck')) return;
|
||||
|
||||
var value = this.chIgnoreUppercase.isChecked();
|
||||
Common.localStorage.setBool("sse-spellcheck-ignore-uppercase-words", value);
|
||||
Common.Utils.InternalSettings.set("sse-spellcheck-ignore-uppercase-words", value);
|
||||
|
|
Loading…
Reference in a new issue