asdds
This commit is contained in:
@@ -22,6 +22,38 @@
|
||||
};
|
||||
|
||||
const bindInteractions = (host, loadRoute) => {
|
||||
host.querySelectorAll('[data-cm-edit-toggle]').forEach((button) => {
|
||||
if (button.dataset.cmBound === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
button.dataset.cmBound = '1';
|
||||
button.addEventListener('click', () => {
|
||||
const targetId = String(button.getAttribute('data-cm-edit-toggle') || '');
|
||||
const target = targetId !== '' ? host.querySelector(`[data-cm-edit-target="${CSS.escape(targetId)}"]`) : null;
|
||||
if (!(target instanceof HTMLElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.hidden = !target.hidden;
|
||||
});
|
||||
});
|
||||
|
||||
host.querySelectorAll('[data-cm-edit-close]').forEach((button) => {
|
||||
if (button.dataset.cmBound === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
button.dataset.cmBound = '1';
|
||||
button.addEventListener('click', () => {
|
||||
const targetId = String(button.getAttribute('data-cm-edit-close') || '');
|
||||
const target = targetId !== '' ? host.querySelector(`[data-cm-edit-target="${CSS.escape(targetId)}"]`) : null;
|
||||
if (target instanceof HTMLElement) {
|
||||
target.hidden = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
host.querySelectorAll('form[action]').forEach((form) => {
|
||||
if (form.dataset.cmBound === '1') {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user