mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +08:00
Only select entire misspelled word when right-clicking, focus it #677
This commit is contained in:
parent
f74236ec03
commit
3b5bf92672
|
@ -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,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue