[PE] Use FeaturesManager component for spellcheck customization
This commit is contained in:
parent
78148155f0
commit
cd2ad9b2e6
|
@ -368,9 +368,11 @@ define([
|
|||
this.api.asc_setAutoSaveGap(value);
|
||||
}
|
||||
|
||||
value = Common.localStorage.getBool("pe-settings-spellcheck", true);
|
||||
Common.Utils.InternalSettings.set("pe-settings-spellcheck", value);
|
||||
this.api.asc_setSpellCheck(value);
|
||||
if (Common.UI.FeaturesManager.canChange('spellcheck')) {
|
||||
value = Common.localStorage.getBool("pe-settings-spellcheck", true);
|
||||
Common.Utils.InternalSettings.set("pe-settings-spellcheck", value);
|
||||
this.api.asc_setSpellCheck(value);
|
||||
}
|
||||
|
||||
value = parseInt(Common.localStorage.getItem("pe-settings-paste-button"));
|
||||
Common.Utils.InternalSettings.set("pe-settings-paste-button", value);
|
||||
|
|
|
@ -775,9 +775,17 @@ define([
|
|||
var zf = (value!==null) ? parseInt(value) : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom) : -1);
|
||||
(zf == -1) ? this.api.zoomFitToPage() : ((zf == -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100));
|
||||
|
||||
value = Common.localStorage.getBool("pe-settings-spellcheck", !(this.appOptions.customization && this.appOptions.customization.spellcheck===false));
|
||||
Common.Utils.InternalSettings.set("pe-settings-spellcheck", value);
|
||||
// spellcheck
|
||||
value = Common.UI.FeaturesManager.getInitValue('spellcheck');
|
||||
value = (value !== undefined) ? value : !(this.appOptions.customization && this.appOptions.customization.spellcheck===false);
|
||||
if (this.appOptions.customization && this.appOptions.customization.spellcheck!==undefined)
|
||||
console.log("Obsolete: The 'spellcheck' parameter of the 'customization' section is deprecated. Please use 'spellcheck' parameter in the 'customization.features' section instead.");
|
||||
if (Common.UI.FeaturesManager.canChange('spellcheck')) { // get from local storage
|
||||
value = Common.localStorage.getBool("pe-settings-spellcheck", value);
|
||||
Common.Utils.InternalSettings.set("pe-settings-spellcheck", value);
|
||||
}
|
||||
me.api.asc_setSpellCheck(value);
|
||||
Common.NotificationCenter.trigger('spelling:turn', value ? 'on' : 'off', true); // only toggle buttons
|
||||
|
||||
value = Common.localStorage.getBool('pe-hidden-notes', this.appOptions.customization && this.appOptions.customization.hideNotes===true);
|
||||
me.api.asc_ShowNotes(!value);
|
||||
|
@ -1148,6 +1156,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.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false);
|
||||
|
||||
|
|
|
@ -107,6 +107,12 @@ define([
|
|||
me.btnDocLang = review.getButton('doclang', 'statusbar');
|
||||
me.btnDocLang.render( me.statusbar.$el.find('#btn-doc-lang') );
|
||||
|
||||
var isVisible = (Common.UI.LayoutManager.isElementVisible('statusBar-textLang') || Common.UI.LayoutManager.isElementVisible('statusBar-docLang'))
|
||||
&& Common.UI.FeaturesManager.canChange('spellcheck');
|
||||
me.btnDocLang.$el.find('+.separator.space')[isVisible?'show':'hide']();
|
||||
isVisible = Common.UI.LayoutManager.isElementVisible('statusBar-textLang') || Common.UI.LayoutManager.isElementVisible('statusBar-docLang')
|
||||
|| Common.UI.FeaturesManager.canChange('spellcheck');
|
||||
me.statusbar.$el.find('.el-lang')[isVisible?'show':'hide']();
|
||||
} else {
|
||||
me.statusbar.$el.find('.el-edit, .el-review').hide();
|
||||
}
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
<label id="status-label-action" class="status-label"></label>
|
||||
</div>
|
||||
<div class="status-group" style="">
|
||||
<span id="btn-cnt-lang" class="el-edit"></span>
|
||||
<span id="btn-doc-lang" class="el-edit"></span>
|
||||
<span id="btn-cnt-lang" class="el-edit" data-layout-name="statusBar-textLang"></span>
|
||||
<span id="btn-doc-lang" class="el-edit" data-layout-name="statusBar-docLang"></span>
|
||||
<div class="separator short el-edit space"></div>
|
||||
<span id="btn-doc-spell" class="el-edit"></span>
|
||||
<div class="separator short el-edit"></div>
|
||||
<div class="separator short el-edit el-lang"></div>
|
||||
<button id="btn-zoom-topage" type="button" class="btn small btn-toolbar" data-hint="0" data-hint-direction="top" data-hint-offset="small"><i class="icon toolbar__icon btn-ic-zoomtoslide"></i></button>
|
||||
<button id="btn-zoom-towidth" type="button" class="btn small btn-toolbar" data-hint="0" data-hint-direction="top" data-hint-offset="small"><i class="icon toolbar__icon btn-ic-zoomtowidth"></i></button>
|
||||
<button id="btn-zoom-down" type="button" class="btn small btn-toolbar"><i class="icon toolbar__icon btn-zoomdown"></i></button>
|
||||
|
|
|
@ -196,10 +196,10 @@ define([
|
|||
template: _.template([
|
||||
'<div class="flex-settings">',
|
||||
'<table style="margin: 30px 0 0;"><tbody>',
|
||||
'<tr class="edit">',
|
||||
'<tr class="edit spellcheck">',
|
||||
'<td class="left"><label><%= scope.txtSpellCheck %></label></td>',
|
||||
'<td class="right"><div id="fms-chb-spell-check"></div></td>',
|
||||
'</tr>','<tr class="divider edit"></tr>',
|
||||
'</tr>','<tr class="divider edit spellcheck"></tr>',
|
||||
'<tr class="edit">',
|
||||
'<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="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtAutoCorrect %></button></div></td>',
|
||||
|
@ -520,6 +520,7 @@ define([
|
|||
$('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide']();
|
||||
/** coauthoring end **/
|
||||
$('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show']();
|
||||
$('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide']();
|
||||
|
||||
if ( !Common.UI.Themes.available() ) {
|
||||
$('tr.themes, tr.themes + tr.divider', this.el).hide();
|
||||
|
@ -532,7 +533,8 @@ define([
|
|||
},
|
||||
|
||||
updateSettings: function() {
|
||||
this.chSpell.setValue(Common.Utils.InternalSettings.get("pe-settings-spellcheck"));
|
||||
if (Common.UI.FeaturesManager.canChange('spellcheck'))
|
||||
this.chSpell.setValue(Common.Utils.InternalSettings.get("pe-settings-spellcheck"));
|
||||
|
||||
this.chInputMode.setValue(Common.Utils.InternalSettings.get("pe-settings-inputmode"));
|
||||
|
||||
|
@ -592,7 +594,8 @@ define([
|
|||
|
||||
applySettings: function() {
|
||||
Common.UI.Themes.setTheme(this.cmbTheme.getValue());
|
||||
Common.localStorage.setItem("pe-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
|
||||
if (Common.UI.FeaturesManager.canChange('spellcheck'))
|
||||
Common.localStorage.setItem("pe-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
|
||||
Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0);
|
||||
Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue());
|
||||
Common.Utils.InternalSettings.set("pe-settings-zoom", Common.localStorage.getItem("pe-settings-zoom"));
|
||||
|
|
|
@ -269,7 +269,6 @@ define([
|
|||
caption : 'English (United States)',
|
||||
hint: this.tipSetLang,
|
||||
hintAnchor : 'top-left',
|
||||
style : 'margin-left: 6px;',
|
||||
disabled: true,
|
||||
dataHint : '0',
|
||||
dataHintDirection: 'top',
|
||||
|
|
|
@ -33,20 +33,11 @@
|
|||
}
|
||||
|
||||
#btn-zoom-topage {
|
||||
margin-right: 9px;
|
||||
margin-left: 6px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
#btn-zoom-towidth {
|
||||
margin-right: 9px;
|
||||
}
|
||||
|
||||
#btn-doc-lang {
|
||||
margin-right: 9px;
|
||||
}
|
||||
|
||||
#btn-doc-spell {
|
||||
margin-right: 5px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.status-group {
|
||||
|
@ -60,10 +51,16 @@
|
|||
}
|
||||
|
||||
.separator {
|
||||
margin: -2px 3px 0 4px;
|
||||
margin: 0 6px;
|
||||
|
||||
&.short {
|
||||
height: 25px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
&.space {
|
||||
margin: 0px 2px;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue