From 3386dace3bed2156fbe436e8d7512604766e6041 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 10 Jan 2020 19:56:27 +0100 Subject: [PATCH] provide context menu in text editor also with disabled spellcheck --- package-lock.json | 2 +- src/public/javascripts/dialogs/options/other.js | 2 +- src/public/javascripts/services/spell_check.js | 11 ++++++----- src/views/dialogs/about.ejs | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 644412e5f..b5b4953a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "trilium", - "version": "0.39.3", + "version": "0.39.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/public/javascripts/dialogs/options/other.js b/src/public/javascripts/dialogs/options/other.js index 8c79ded40..ec82e3c81 100644 --- a/src/public/javascripts/dialogs/options/other.js +++ b/src/public/javascripts/dialogs/options/other.js @@ -6,7 +6,7 @@ const TPL = `

Spell check

-

These options apply only for desktop builds, browsers will use their own native spell check.

+

These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.

diff --git a/src/public/javascripts/services/spell_check.js b/src/public/javascripts/services/spell_check.js index f75e33157..aee0f379c 100644 --- a/src/public/javascripts/services/spell_check.js +++ b/src/public/javascripts/services/spell_check.js @@ -3,15 +3,16 @@ import optionsService from "./options.js"; export async function initSpellCheck() { const options = await optionsService.waitForOptions(); - if (!options.is('spellCheckEnabled')) { - return; - } - const {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker'); const {remote, shell} = require('electron'); const spellCheckHandler = new SpellCheckHandler(); - spellCheckHandler.attachToInput(); + + // not fully disabling the spellcheck since we want to preserve the context menu + // this will just get rid of the "red squiggles" + if (options.is('spellCheckEnabled')) { + spellCheckHandler.attachToInput(); + } spellCheckHandler.switchLanguage(options.get('spellCheckLanguageCode')); diff --git a/src/views/dialogs/about.ejs b/src/views/dialogs/about.ejs index aabb27221..1ce633e43 100644 --- a/src/views/dialogs/about.ejs +++ b/src/views/dialogs/about.ejs @@ -9,7 +9,7 @@