mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
fix closeOnClickOutside
register multiple times
This commit is contained in:
parent
2872c9e449
commit
e9dff89206
@ -75,15 +75,6 @@ export default class WindowManager extends Core {
|
||||
id = newId
|
||||
}
|
||||
|
||||
// if closeOnClickOutside is true, add click event listener
|
||||
if (closeOnClickOutside === true) {
|
||||
document.addEventListener(
|
||||
"click",
|
||||
(e) => this.handleWrapperClick(id, e),
|
||||
{ once: true },
|
||||
)
|
||||
}
|
||||
|
||||
// check if window already exist, if exist and createOrUpdate is true, update the element
|
||||
// if not exist, create a new element
|
||||
if (this.root.querySelector(`#${id}`) && createOrUpdate) {
|
||||
@ -111,6 +102,15 @@ export default class WindowManager extends Core {
|
||||
}
|
||||
|
||||
this.windows.push(win)
|
||||
|
||||
// if closeOnClickOutside is true, add click event listener
|
||||
if (closeOnClickOutside === true) {
|
||||
document.addEventListener(
|
||||
"click",
|
||||
(e) => this.handleWrapperClick(id, e),
|
||||
{ once: true },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// if useFrame is true, wrap the fragment with a DefaultWindow component
|
||||
|
Loading…
x
Reference in New Issue
Block a user