Only select entire misspelled word when right-clicking, focus it #677

This commit is contained in:
Ben Gotow 2018-02-14 14:38:27 -08:00
parent f74236ec03
commit 3b5bf92672

View file

@ -36,7 +36,12 @@ function renderMark(props) {
if (mark.type === MISSPELLED_TYPE) {
return (
<span
onMouseDown={() => {
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,
})
)
);