Rebounce navigation events
This commit is contained in:
@@ -19,16 +19,23 @@ let {
|
||||
let dialog: Dialog = $state()
|
||||
let node: FSNode = $state(null)
|
||||
|
||||
export const open = async (n: FSNode, target: EventTarget) => {
|
||||
export const open = async (n: FSNode, target: EventTarget, event: Event) => {
|
||||
node = n
|
||||
let el: HTMLElement = (target as Element).closest("button")
|
||||
if (el === null) {
|
||||
el = (target as Element).closest("a")
|
||||
}
|
||||
|
||||
// Wait for the view to update, so the dialog gets the proper measurements
|
||||
await tick()
|
||||
dialog.open(el.getBoundingClientRect())
|
||||
|
||||
let el: HTMLElement = (target as Element).closest("button")
|
||||
if (el !== null) {
|
||||
dialog.open(el.getBoundingClientRect())
|
||||
return
|
||||
}
|
||||
|
||||
if (event instanceof MouseEvent) {
|
||||
dialog.open(event)
|
||||
return
|
||||
}
|
||||
|
||||
console.error("Cannot find suitable target for spawning dialog window")
|
||||
}
|
||||
|
||||
const delete_node = async () => {
|
||||
|
||||
Reference in New Issue
Block a user