UBERF-8265 Handle undefined editor in TextEDitorToolbar (#6718)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-09-25 12:22:28 +07:00 committed by GitHub
parent 6fd8018baf
commit 33c7615201
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,7 +99,7 @@
function handleMouseDown (): void {
function handleMouseMove (): void {
if (!editor.state.selection.empty) {
if (editor !== undefined && !editor.state.selection.empty) {
selecting = true
document.removeEventListener('mousemove', handleMouseMove)
}
@ -112,8 +112,10 @@
document.removeEventListener('mouseup', handleMouseUp)
}
document.addEventListener('mousemove', handleMouseMove)
document.addEventListener('mouseup', handleMouseUp)
if (editor !== undefined) {
document.addEventListener('mousemove', handleMouseMove)
document.addEventListener('mouseup', handleMouseUp)
}
}
onMount(() => {