Fixing issue #2689 with broken right click when spell check is disabled (#2708)

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Victor Sheremetov 2020-01-07 04:33:20 +03:00 committed by Scott Nonnenberg
parent 1a2031d584
commit ddb5e90967

View file

@ -142,12 +142,23 @@ const dummyChecker = {
window.spellChecker = simpleChecker;
window.disableSpellCheck = () => {
window.removeEventListener('contextmenu', spellCheckHandler);
window.addEventListener('contextmenu', defaultContextMenuHandler);
webFrame.setSpellCheckProvider('en-US', dummyChecker);
};
window.enableSpellCheck = () => {
webFrame.setSpellCheckProvider('en-US', simpleChecker);
window.addEventListener('contextmenu', spellCheckHandler);
window.removeEventListener('contextmenu', defaultContextMenuHandler);
};
const defaultContextMenuHandler = () => {
const menu = buildEditorContextMenu({});
// @see js/spell_check.js:183
setTimeout(() => {
menu.popup(remote.getCurrentWindow());
}, 30);
};
const spellCheckHandler = e => {