drop ENABLE_SPELL_CHECKER

This commit is contained in:
Raphaël Jakse 2020-10-16 18:34:01 +02:00
parent b23f70ea31
commit ba4631e3dd
3 changed files with 10 additions and 8 deletions

View File

@ -10,7 +10,7 @@ endif
.PHONY: all help lang start-dev-server
all: lang
all: lang emptydictlist
help:
@echo make extract-lang-dists: extract the distributions per language from Wikipedia
@ -26,6 +26,11 @@ extract-lang-dists:
lang: public/l10n/js/fr.js
emptydictlist: public/dict/list.js
public/dict/list.js:
mkdir -p public/dict/ && touch public/dict/list.js
eslint:
-${ESLINT} **/*.js

View File

@ -17,9 +17,6 @@ window.TrivabbleConf = {
// To tweak only if your webserver is shared with other conflicting resources at / (e.g. Yunohost integration)
APP_PATH: "",
// Whether the spell checker is enabled (dictionaries must be downloaded on the server before enabling this option)
ENABLE_SPELL_CHECKER: false,
// The color of the flash light when double clicking on a cell
FLASH_LIGHT_COLOR: "#EE6633",

View File

@ -54,7 +54,6 @@
setConf("APP_PATH", "");
setConf("ENABLE_MSG_SOUND", true);
setConf("ENABLE_TILE_SOUND", true);
setConf("ENABLE_SPELL_CHECKER", false);
setConf("DOUBLE_TAP_DURATIONS", [650, 1100, 1800, 3000, 5000]);
setConf("DOUBLE_TAP_DURATION", middle("DOUBLE_TAP_DURATIONS"));
setConf("FLASH_LIGHT_DURATIONS", [800, 1600, 3200]);
@ -251,8 +250,10 @@
function checkDictionaryExistance() {
const code = document.getElementById("board-lang").value;
const availableLang = Object.prototype.hasOwnProperty.call(DictionaryList, code);
document.getElementById("disable-spell-checker-p").hidden = !availableLang;
if (Object.prototype.hasOwnProperty.call(DictionaryList, code) && getSetting("ENABLE_SPELL_CHECKER") && !document.getElementById("disable-spell-checker").checked) {
if (availableLang && !document.getElementById("disable-spell-checker").checked) {
document.getElementById("check-spelling").hidden = false;
document.getElementById("info-spell-checking").hidden = false;
} else {
@ -1995,7 +1996,7 @@
}
function toggleSpellChecker(e) {
const disabled = !getSetting("ENABLE_SPELL_CHECKER") || document.getElementById("disable-spell-checker").checked;
const disabled = document.getElementById("disable-spell-checker").checked;
checkDictionaryExistance();
if (e) {
@ -2008,7 +2009,6 @@
}
function initSpellChecker() {
document.getElementById("disable-spell-checker-p").hidden = !getSetting("ENABLE_SPELL_CHECKER");
document.getElementById("disable-spell-checker").checked = getSetting("DisableSpellChecker");
toggleSpellChecker();
}