mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 22:42:32 -05:00
adjust nav
This commit is contained in:
1 parent
44972fcc39
commit
073859a4b7
17 files changed
+287
-72
No files matched your search
@@ -21,6 +21,7 @@ export default class extends HTMLElement {
|
||||
title: this.dataset.label || target?.textContent.trim(),
|
||||
icon: this.dataset.icon,
|
||||
placement: this.dataset.placement || 'menu',
|
||||
section: this.dataset.section,
|
||||
native: this.dataset.native,
|
||||
url: this.dataset.url,
|
||||
accept: this.dataset.accept,
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
export default class extends HTMLElement {
|
||||
connectedCallback () {
|
||||
this.addEventListener('click', this.dispatch)
|
||||
}
|
||||
|
||||
disconnectedCallback () {
|
||||
this.removeEventListener('click', this.dispatch)
|
||||
}
|
||||
|
||||
dispatch = async () => {
|
||||
const bridge = window.webkit?.messageHandlers?.modal
|
||||
|
||||
if (!bridge || this.dataset.loading) return
|
||||
|
||||
let detail = this.dataset.detail || 'null'
|
||||
|
||||
if (this.dataset.src) {
|
||||
this.dataset.loading = 'true'
|
||||
|
||||
try {
|
||||
const response = await fetch(this.dataset.src, { headers: { Accept: 'application/json' } })
|
||||
|
||||
if (!response.ok) return
|
||||
|
||||
detail = await response.text()
|
||||
} catch {
|
||||
return
|
||||
} finally {
|
||||
delete this.dataset.loading
|
||||
}
|
||||
}
|
||||
|
||||
bridge.postMessage({ action: 'dispatch', name: this.dataset.name, detail })
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user