From 8f01d1dbb7cae37b4ea47eafd8f0193790737eb5 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 30 Mar 2020 12:38:26 +1100 Subject: [PATCH] enable by default spell-check --- js/background.js | 5 ++++- ts/components/session/settings/SessionSettings.tsx | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/background.js b/js/background.js index 4ee9fe0da..b689b581b 100644 --- a/js/background.js +++ b/js/background.js @@ -1023,7 +1023,10 @@ }; window.toggleSpellCheck = () => { - const newValue = !window.getSettingValue('spell-check'); + const currentValue = window.getSettingValue('spell-check'); + // if undefined, it means 'default' so true. but we have to toggle it, so false + // if not undefined, we take the opposite + const newValue = currentValue !== undefined? !currentValue : false; window.Events.setSpellCheck(newValue); window.pushToast({ description: window.i18n('spellCheckDirty'), diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index b83188def..ddaf5a3cf 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -116,9 +116,8 @@ export class SettingsView extends React.Component { const description = setting.description || ''; const comparisonValue = setting.comparisonValue || null; - const value = - window.getSettingValue(setting.id, comparisonValue) || - (setting.content && setting.content.defaultValue); + const storedSetting = window.getSettingValue(setting.id, comparisonValue); + const value = storedSetting !== undefined ? storedSetting : setting.content && setting.content.defaultValue; const sliderFn = setting.type === SessionSettingType.Slider @@ -356,7 +355,7 @@ export class SettingsView extends React.Component { type: SessionSettingType.Toggle, category: SessionSettingCategory.Appearance, setFn: window.toggleSpellCheck, - content: undefined, + content: { defaultValue: true }, comparisonValue: undefined, onClick: undefined, confirmationDialogParams: undefined,