refs #2028 Add a configuration item to disable spellchecker
This commit is contained in:
parent
3d4ffb5812
commit
24a7cb14ed
|
@ -19,7 +19,8 @@ const state = (): GeneralState => {
|
||||||
hideAllAttachments: false
|
hideAllAttachments: false
|
||||||
},
|
},
|
||||||
other: {
|
other: {
|
||||||
launch: false
|
launch: false,
|
||||||
|
spellcheck: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loading: false
|
loading: false
|
||||||
|
|
|
@ -15,7 +15,8 @@ describe('Preferences/General', () => {
|
||||||
hideAllAttachments: false
|
hideAllAttachments: false
|
||||||
},
|
},
|
||||||
other: {
|
other: {
|
||||||
launch: false
|
launch: false,
|
||||||
|
spellcheck: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loading: false
|
loading: false
|
||||||
|
|
|
@ -135,7 +135,17 @@
|
||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"title": "Other options",
|
"title": "Other options",
|
||||||
"launch": "Launch app on login"
|
"launch": "Launch app on login",
|
||||||
|
"spellcheck": {
|
||||||
|
"description": "Enable spellchecker",
|
||||||
|
"notice": "Requires relaunch",
|
||||||
|
"confirm": {
|
||||||
|
"title": "Warning",
|
||||||
|
"message": "You have to restart this application. Continue?",
|
||||||
|
"ok": "Restart Now",
|
||||||
|
"cancel": "Cancel"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"appearance": {
|
"appearance": {
|
||||||
|
|
|
@ -200,6 +200,16 @@ async function getLanguage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getSpellChecker = async (): Promise<boolean> => {
|
||||||
|
try {
|
||||||
|
const preferences = new Preferences(preferencesDBPath)
|
||||||
|
const conf = await preferences.load()
|
||||||
|
return conf.general.other.spellcheck
|
||||||
|
} catch (err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getMenuPreferences = async (): Promise<MenuPreferences> => {
|
const getMenuPreferences = async (): Promise<MenuPreferences> => {
|
||||||
const preferences = new Preferences(preferencesDBPath)
|
const preferences = new Preferences(preferencesDBPath)
|
||||||
const conf = await preferences.load()
|
const conf = await preferences.load()
|
||||||
|
@ -225,6 +235,11 @@ async function createWindow() {
|
||||||
const language = await getLanguage()
|
const language = await getLanguage()
|
||||||
i18next.changeLanguage(language)
|
i18next.changeLanguage(language)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get spellcheck
|
||||||
|
*/
|
||||||
|
const spellcheck = await getSpellChecker()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load system theme color for dark mode
|
* Load system theme color for dark mode
|
||||||
*/
|
*/
|
||||||
|
@ -283,7 +298,7 @@ async function createWindow() {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
preload: path.resolve(__dirname, './preload.js'),
|
preload: path.resolve(__dirname, './preload.js'),
|
||||||
spellcheck: true
|
spellcheck: spellcheck
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const config: Config = {
|
const config: Config = {
|
||||||
|
@ -907,7 +922,9 @@ ipcMain.handle('get-preferences', async (_: IpcMainInvokeEvent) => {
|
||||||
await preferences
|
await preferences
|
||||||
.update({
|
.update({
|
||||||
general: {
|
general: {
|
||||||
other: enabled
|
other: {
|
||||||
|
launch: enabled
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => console.error(err))
|
.catch(err => console.error(err))
|
||||||
|
|
|
@ -27,7 +27,8 @@ const timeline: Timeline = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const other: Other = {
|
const other: Other = {
|
||||||
launch: false
|
launch: false,
|
||||||
|
spellcheck: true
|
||||||
}
|
}
|
||||||
|
|
||||||
const general: General = {
|
const general: General = {
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
<el-form-item for="launch" :label="$t('preferences.general.other.launch')">
|
<el-form-item for="launch" :label="$t('preferences.general.other.launch')">
|
||||||
<el-switch id="launch" v-model="other_launch" active-color="#13ce66"> </el-switch>
|
<el-switch id="launch" v-model="other_launch" active-color="#13ce66"> </el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item for="spellcheck" :label="$t('preferences.general.other.spellcheck.description')">
|
||||||
|
<el-switch id="spellcheck" v-model="other_spellcheck" active-color="#13ce66"> </el-switch>
|
||||||
|
<p class="notice">{{ $t('preferences.general.other.spellcheck.notice') }}</p>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -105,6 +109,20 @@ export default {
|
||||||
launch: value
|
launch: value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
other_spellcheck: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.Preferences.General.general.other.spellcheck
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store
|
||||||
|
.dispatch('Preferences/General/updateOther', {
|
||||||
|
spellcheck: value
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.confirm()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -114,6 +132,23 @@ export default {
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
confirm() {
|
||||||
|
this.$confirm(
|
||||||
|
this.$t('preferences.general.other.spellcheck.confirm.message'),
|
||||||
|
this.$t('preferences.general.other.spellcheck.confirm.title'),
|
||||||
|
{
|
||||||
|
confirmButtonText: this.$t('preferences.general.other.spellcheck.confirm.ok'),
|
||||||
|
cancelButtonText: this.$t('preferences.general.other.spellcheck.confirm.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
this.$store.dispatch('Preferences/General/relaunch')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -140,5 +175,10 @@ export default {
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notice {
|
||||||
|
color: #c0c4cc;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -24,7 +24,8 @@ const state = (): GeneralState => ({
|
||||||
hideAllAttachments: false
|
hideAllAttachments: false
|
||||||
},
|
},
|
||||||
other: {
|
other: {
|
||||||
launch: false
|
launch: false,
|
||||||
|
spellcheck: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loading: false
|
loading: false
|
||||||
|
@ -96,6 +97,9 @@ const actions: ActionTree<GeneralState, RootState> = {
|
||||||
commit(MUTATION_TYPES.UPDATE_GENERAL, conf.general as General)
|
commit(MUTATION_TYPES.UPDATE_GENERAL, conf.general as General)
|
||||||
dispatch('App/loadPreferences', null, { root: true })
|
dispatch('App/loadPreferences', null, { root: true })
|
||||||
await win.ipcRenderer.invoke('change-auto-launch', newOther.launch)
|
await win.ipcRenderer.invoke('change-auto-launch', newOther.launch)
|
||||||
|
},
|
||||||
|
relaunch: () => {
|
||||||
|
win.ipcRenderer.send('relaunch')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { Proxy } from '~/src/types/proxy'
|
||||||
|
|
||||||
export type Other = {
|
export type Other = {
|
||||||
launch: boolean
|
launch: boolean
|
||||||
|
spellcheck: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type General = {
|
export type General = {
|
||||||
|
|
Loading…
Reference in New Issue