mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 20:13:46 -05:00
[cm6] close autocomplete menu on blur
GitOrigin-RevId: e1475e1a1b4a0f05ab2926cfc5612abb3b9f39e8
This commit is contained in:
parent
466011df86
commit
4c2537a753
1 changed files with 12 additions and 0 deletions
|
@ -10,6 +10,7 @@ import { misspelledWordsField } from './misspelled-words'
|
||||||
import { addIgnoredWord } from './ignored-words'
|
import { addIgnoredWord } from './ignored-words'
|
||||||
import { learnWordRequest } from './backend'
|
import { learnWordRequest } from './backend'
|
||||||
import { Word } from './spellchecker'
|
import { Word } from './spellchecker'
|
||||||
|
import { closeCompletion } from '@codemirror/autocomplete'
|
||||||
|
|
||||||
const ITEMS_TO_SHOW = 8
|
const ITEMS_TO_SHOW = 8
|
||||||
|
|
||||||
|
@ -118,6 +119,17 @@ export const spellingMenuField = StateField.define<Tooltip | null>({
|
||||||
EditorView.domEventHandlers({
|
EditorView.domEventHandlers({
|
||||||
contextmenu: handleContextMenuEvent,
|
contextmenu: handleContextMenuEvent,
|
||||||
click: handleClickEvent,
|
click: handleClickEvent,
|
||||||
|
blur: (event, view: EditorView) => {
|
||||||
|
if (
|
||||||
|
event.relatedTarget instanceof HTMLButtonElement &&
|
||||||
|
event.relatedTarget.classList.contains('advanced-ref-search')
|
||||||
|
) {
|
||||||
|
// prevent closing autocomplete menu if "advanced references search" Open button is clicked
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
closeCompletion(view)
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue