From e151be6b898cd27c9948bfcc907ef3f53d7faaed Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Fri, 21 Feb 2025 13:22:25 +0000 Subject: [PATCH] Avoid selecting word when opening spell check context menu (#23756) GitOrigin-RevId: 0276979d18583f5813476b2ac01a8eb33b352fcb --- .../extensions/spelling/context-menu.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/extensions/spelling/context-menu.tsx b/services/web/frontend/js/features/source-editor/extensions/spelling/context-menu.tsx index b1b88a01cc..0007b85f84 100644 --- a/services/web/frontend/js/features/source-editor/extensions/spelling/context-menu.tsx +++ b/services/web/frontend/js/features/source-editor/extensions/spelling/context-menu.tsx @@ -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,