mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Avoid selecting word when opening spell check context menu (#23756)
GitOrigin-RevId: 0276979d18583f5813476b2ac01a8eb33b352fcb
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user