[DE mobile][PE mobile] Refactoring spellcheck. Bug 42696

This commit is contained in:
Julia Radzhabova 2019-09-04 15:51:09 +03:00
parent 2a141b4ceb
commit be9772abaf
4 changed files with 8 additions and 4 deletions

View file

@ -535,7 +535,8 @@ define([
value = Common.localStorage.getItem("de-show-tableline"); value = Common.localStorage.getItem("de-show-tableline");
me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true); me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true);
value = Common.localStorage.getBool("de-mobile-spellcheck", false); value = Common.localStorage.getBool("de-mobile-spellcheck", !(this.appOptions.customization && this.appOptions.customization.spellcheck===false));
Common.Utils.InternalSettings.set("de-mobile-spellcheck", value);
me.api.asc_setSpellCheck(value); me.api.asc_setSpellCheck(value);
me.api.asc_registerCallback('asc_onStartAction', _.bind(me.onLongActionBegin, me)); me.api.asc_registerCallback('asc_onStartAction', _.bind(me.onLongActionBegin, me));

View file

@ -229,7 +229,7 @@ define([
Common.Utils.addScrollIfNeed('.page[data-page=settings-about-view]', '.page[data-page=settings-about-view] .page-content'); Common.Utils.addScrollIfNeed('.page[data-page=settings-about-view]', '.page[data-page=settings-about-view] .page-content');
} else if ('#settings-advanced-view' == pageId) { } else if ('#settings-advanced-view' == pageId) {
me.initPageAdvancedSettings(); me.initPageAdvancedSettings();
$('#settings-spellcheck input:checkbox').attr('checked', Common.localStorage.getBool("de-mobile-spellcheck", false)); $('#settings-spellcheck input:checkbox').attr('checked', Common.Utils.InternalSettings.get("de-mobile-spellcheck"));
$('#settings-spellcheck input:checkbox').single('change', _.bind(me.onSpellcheck, me)); $('#settings-spellcheck input:checkbox').single('change', _.bind(me.onSpellcheck, me));
$('#settings-no-characters input:checkbox').attr('checked', (Common.localStorage.getItem("de-mobile-no-characters") == 'true') ? true : false); $('#settings-no-characters input:checkbox').attr('checked', (Common.localStorage.getItem("de-mobile-no-characters") == 'true') ? true : false);
$('#settings-no-characters input:checkbox').single('change', _.bind(me.onNoCharacters, me)); $('#settings-no-characters input:checkbox').single('change', _.bind(me.onNoCharacters, me));
@ -543,6 +543,7 @@ define([
var $checkbox = $(e.currentTarget), var $checkbox = $(e.currentTarget),
state = $checkbox.is(':checked'); state = $checkbox.is(':checked');
Common.localStorage.setItem("de-mobile-spellcheck", state ? 1 : 0); Common.localStorage.setItem("de-mobile-spellcheck", state ? 1 : 0);
Common.Utils.InternalSettings.set("de-mobile-spellcheck", state);
this.api && this.api.asc_setSpellCheck(state); this.api && this.api.asc_setSpellCheck(state);
}, },

View file

@ -497,7 +497,8 @@ define([
var zf = (value!==null) ? parseInt(value) : (me.appOptions.customization && me.appOptions.customization.zoom ? parseInt(me.appOptions.customization.zoom) : -1); var zf = (value!==null) ? parseInt(value) : (me.appOptions.customization && me.appOptions.customization.zoom ? parseInt(me.appOptions.customization.zoom) : -1);
(zf == -1) ? me.api.zoomFitToPage() : ((zf == -2) ? me.api.zoomFitToWidth() : me.api.zoom(zf>0 ? zf : 100)); (zf == -1) ? me.api.zoomFitToPage() : ((zf == -2) ? me.api.zoomFitToWidth() : me.api.zoom(zf>0 ? zf : 100));
value = Common.localStorage.getBool("pe-mobile-spellcheck", false); value = Common.localStorage.getBool("pe-mobile-spellcheck", !(this.appOptions.customization && this.appOptions.customization.spellcheck===false));
Common.Utils.InternalSettings.set("pe-mobile-spellcheck", value);
me.api.asc_setSpellCheck(value); me.api.asc_setSpellCheck(value);
me.api.asc_registerCallback('asc_onStartAction', _.bind(me.onLongActionBegin, me)); me.api.asc_registerCallback('asc_onStartAction', _.bind(me.onLongActionBegin, me));

View file

@ -156,7 +156,7 @@ define([
onPageShow: function(view, pageId) { onPageShow: function(view, pageId) {
var me = this; var me = this;
$('#settings-spellcheck input:checkbox').attr('checked', Common.localStorage.getBool("pe-mobile-spellcheck", false)); $('#settings-spellcheck input:checkbox').attr('checked', Common.Utils.InternalSettings.get("pe-mobile-spellcheck"));
$('#settings-search').single('click', _.bind(me._onSearch, me)); $('#settings-search').single('click', _.bind(me._onSearch, me));
$('#settings-readermode input:checkbox').single('change', _.bind(me._onReaderMode, me)); $('#settings-readermode input:checkbox').single('change', _.bind(me._onReaderMode, me));
$('#settings-spellcheck input:checkbox').single('change', _.bind(me._onSpellcheck, me)); $('#settings-spellcheck input:checkbox').single('change', _.bind(me._onSpellcheck, me));
@ -357,6 +357,7 @@ define([
var $checkbox = $(e.currentTarget), var $checkbox = $(e.currentTarget),
state = $checkbox.is(':checked'); state = $checkbox.is(':checked');
Common.localStorage.setItem("pe-mobile-spellcheck", state ? 1 : 0); Common.localStorage.setItem("pe-mobile-spellcheck", state ? 1 : 0);
Common.Utils.InternalSettings.set("pe-mobile-spellcheck", state);
this.api && this.api.asc_setSpellCheck(state); this.api && this.api.asc_setSpellCheck(state);
}, },