From 3b5bf9267249594a4962f152c55de32d5ecc7a0d Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Wed, 14 Feb 2018 14:38:27 -0800 Subject: [PATCH] Only select entire misspelled word when right-clicking, focus it #677 --- app/src/components/composer-editor/spellcheck-plugins.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/components/composer-editor/spellcheck-plugins.jsx b/app/src/components/composer-editor/spellcheck-plugins.jsx index 8e17826c9..db952a927 100644 --- a/app/src/components/composer-editor/spellcheck-plugins.jsx +++ b/app/src/components/composer-editor/spellcheck-plugins.jsx @@ -36,7 +36,12 @@ function renderMark(props) { if (mark.type === MISSPELLED_TYPE) { return ( { + onMouseDown={event => { + if (!event.metaKey && !event.ctrlKey) { + return; + } + event.preventDefault(); + // select the entire word so that the contextual menu offers spelling suggestions const { editor: { onChange, value }, node, offset, text } = props; onChange( value.change().select( @@ -45,6 +50,7 @@ function renderMark(props) { anchorOffset: offset, focusKey: node.key, focusOffset: offset + text.length, + isFocused: true, }) ) );