mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 14:42:32 -05:00
fix ui
This commit is contained in:
1 parent
92bfedd01d
commit
e004ac2d40
6 files changed
+31
-18
No files matched your search
@@ -59,10 +59,10 @@ export async function convertImagesInInput (input) {
|
||||
|
||||
export default class extends HTMLElement {
|
||||
connectedCallback () {
|
||||
const input = this.querySelector('input[type="file"]')
|
||||
const form = input.form
|
||||
this.addEventListener('change', async (e) => {
|
||||
const input = e.target
|
||||
const form = input.form
|
||||
|
||||
input.addEventListener('change', async () => {
|
||||
await convertImagesInInput(input)
|
||||
|
||||
form.querySelector('[type="submit"]')?.setAttribute('disabled', true)
|
||||
|
||||
@@ -14,6 +14,15 @@ export default actionable(targetable(class extends HTMLElement {
|
||||
this.addEventListener('dragover', (e) => e.preventDefault())
|
||||
this.addEventListener('drop', this.onDrop)
|
||||
document.addEventListener('turbo:submit-end', this.toggleLoading)
|
||||
|
||||
if (this.area) {
|
||||
this.initArea()
|
||||
} else {
|
||||
queueMicrotask(() => this.initArea())
|
||||
}
|
||||
}
|
||||
|
||||
initArea () {
|
||||
this.area?.addEventListener('dragover', this.onDragover)
|
||||
this.area?.addEventListener('dragleave', this.onDragleave)
|
||||
}
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
export default class extends HTMLElement {
|
||||
connectedCallback () {
|
||||
this.addEventListener('click', this.onClick)
|
||||
}
|
||||
|
||||
onClick = (event) => {
|
||||
const button = this.querySelector('a, button, label')
|
||||
|
||||
if (!button?.contains(event.target)) return
|
||||
|
||||
const target = this.dataset.targetId ? document.getElementById(this.dataset.targetId) : button
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
this.dataset.classes.split(' ').forEach((cls) => {
|
||||
if (this.dataset.action === 'remove') {
|
||||
target.classList.remove(cls)
|
||||
} else if (this.dataset.action === 'add') {
|
||||
target.classList.add(cls)
|
||||
} else {
|
||||
target.classList.toggle(cls)
|
||||
}
|
||||
})
|
||||
this.dataset.classes.split(' ').forEach((cls) => {
|
||||
if (this.dataset.action === 'remove') {
|
||||
target.classList.remove(cls)
|
||||
} else if (this.dataset.action === 'add') {
|
||||
target.classList.add(cls)
|
||||
} else {
|
||||
target.classList.toggle(cls)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user