UBERF-8600 Fix toolbar disappearing on click (#7223)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-11-22 17:29:15 +07:00 committed by GitHub
parent 1095493fa7
commit fe68f8f4c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,7 +97,7 @@
let selecting = false
function handleMouseDown (): void {
function handleMouseDown (event: MouseEvent): void {
function handleMouseMove (): void {
if (editor !== undefined && !editor.state.selection.empty) {
selecting = true
@ -112,9 +112,11 @@
document.removeEventListener('mouseup', handleMouseUp)
}
if (editor !== undefined) {
document.addEventListener('mousemove', handleMouseMove)
document.addEventListener('mouseup', handleMouseUp)
if (editor !== undefined && visible && visibleActions.length > 0) {
if (event.target !== null && toolbar !== null && !toolbar.contains(event.target as Node)) {
document.addEventListener('mousemove', handleMouseMove)
document.addEventListener('mouseup', handleMouseUp)
}
}
}