import utils from "../../../services/utils.js"; import OptionsTab from "./options_tab.js"; const TPL = `
`; export default class SpellcheckOptions extends OptionsTab { get tabTitle() { return "Spellcheck" } lazyRender() { this.$widget = $(TPL); this.$spellCheckEnabled = this.$widget.find("#spell-check-enabled"); this.$spellCheckLanguageCode = this.$widget.find("#spell-check-language-code"); this.$spellCheckEnabled.on('change', () => this.updateCheckboxOption('spellCheckEnabled', this.$spellCheckEnabled)); this.$spellCheckLanguageCode.on('change', () => this.updateOption('spellCheckLanguageCode', this.$spellCheckLanguageCode.val())); this.$availableLanguageCodes = this.$widget.find("#available-language-codes"); if (utils.isElectron()) { const { webContents } = utils.dynamicRequire('@electron/remote').getCurrentWindow(); this.$availableLanguageCodes.text(webContents.session.availableSpellCheckerLanguages.join(', ')); } } optionsLoaded(options) { this.setCheckboxState(this.$spellCheckEnabled, options.spellCheckEnabled); this.$spellCheckLanguageCode.val(options.spellCheckLanguageCode); } }