Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
1a2031d584
commit
ddb5e90967
1 changed files with 11 additions and 0 deletions
|
@ -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 => {
|
||||
|
|
Loading…
Reference in a new issue