Avoid selecting word when opening spell check context menu (#23756)

GitOrigin-RevId: 0276979d18583f5813476b2ac01a8eb33b352fcb
This commit is contained in:
Alf Eaton
2025-02-21 13:22:25 +00:00
committed by Copybot
parent 816410f2d4
commit e151be6b89

View File

@@ -1,9 +1,4 @@
import {
StateField,
StateEffect,
EditorSelection,
Prec,
} from '@codemirror/state'
import { StateField, StateEffect, Prec } from '@codemirror/state'
import { EditorView, showTooltip, Tooltip, keymap } from '@codemirror/view'
import { Word, Mark, getMarkAtPosition } from './spellchecker'
import { debugConsole } from '@/utils/debugging'
@@ -57,7 +52,7 @@ const handleContextMenuEvent = (event: MouseEvent, view: EditorView) => {
return
}
const { from, to, value } = targetMark
const { value } = targetMark
const targetWord = value.spec.word
if (!targetWord) {
@@ -72,7 +67,6 @@ const handleContextMenuEvent = (event: MouseEvent, view: EditorView) => {
openingUntil = Date.now() + 100
view.dispatch({
selection: EditorSelection.range(from, to),
effects: showSpellingMenu.of({
mark: targetMark,
word: targetWord,
@@ -88,7 +82,6 @@ const handleShortcutEvent = (view: EditorView) => {
}
view.dispatch({
selection: EditorSelection.range(targetMark.from, targetMark.to),
effects: showSpellingMenu.of({
mark: targetMark,
word: targetMark.value.spec.word,