From 5aa3abc8605c19721ced7540a1f3ebc370f6e900 Mon Sep 17 00:00:00 2001
From: th
Date: Wed, 8 Apr 2026 23:13:11 +0200
Subject: [PATCH] fixes
---
public/js/modules/board.js | 8 +++++---
public/js/modules/context-menu.js | 14 +++++++++++++-
public/js/modules/detail.js | 6 ++++--
public/js/modules/gallery.js | 1 +
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/public/js/modules/board.js b/public/js/modules/board.js
index 95a8685..83eff64 100644
--- a/public/js/modules/board.js
+++ b/public/js/modules/board.js
@@ -139,9 +139,11 @@ $('select-tag')?.addEventListener('click', async () => {
$('select-delete')?.addEventListener('click', async () => {
if (!selectedIds.size) return;
- const { showDialog } = await import('./dialog.js');
- const ok = await showDialog({ title: 'delete cards', message: `${selectedIds.size} card${selectedIds.size > 1 ? 's' : ''} loeschen?`, danger: true, okLabel: 'delete' });
- if (!ok) return;
+ if (localStorage.getItem('hyprcrd-confirm-delete') !== '0') {
+ const { showDialog } = await import('./dialog.js');
+ const ok = await showDialog({ title: 'delete cards', message: `${selectedIds.size} card${selectedIds.size > 1 ? 's' : ''} loeschen?`, danger: true, okLabel: 'delete' });
+ if (!ok) return;
+ }
for (const id of selectedIds) {
await api(`api/cards/${id}`, { method: 'DELETE' });
}
diff --git a/public/js/modules/context-menu.js b/public/js/modules/context-menu.js
index 16c4196..8a3459b 100644
--- a/public/js/modules/context-menu.js
+++ b/public/js/modules/context-menu.js
@@ -217,7 +217,19 @@ export function showContextMenu(x, y, card) {
if (ok) { const ch = getChildren(card.id); pushBatch('dissolve', ch.map(c => ({ cardId: c.id, prevData: { parent_id: card.id } }))); await Promise.all(ch.map(c => api(`api/cards/${c.id}`, { method: 'PATCH', body: { parent_id: null } }))); await window._reloadAll(); }
}
else if (a === 'ungroup') { hideContextMenu(); pushCardEdit('ungroup', card.id, { parent_id: card.parent_id }); await api(`api/cards/${card.id}`, { method: 'PATCH', body: { parent_id: null } }); await window._reloadAll(); }
- else if (a === 'delete') { hideContextMenu(); const ok = await showDialog({ title: 'delete_card', message: `"${card.title}" wirklich loeschen?`, danger: true, okLabel: 'delete' }); if (ok) { const wasSync = !!card.caldav_uid; pushCardDelete('delete', snapshotCard(card)); await api(`api/cards/${card.id}`, { method: 'DELETE' }); await window._reloadAll(); if (wasSync) window._triggerSync?.(); } }
+ else if (a === 'delete') {
+ hideContextMenu();
+ const needConfirm = localStorage.getItem('hyprcrd-confirm-delete') !== '0';
+ if (needConfirm) {
+ const ok = await showDialog({ title: 'delete_card', message: `"${card.title}" wirklich loeschen?`, danger: true, okLabel: 'delete' });
+ if (!ok) return;
+ }
+ const wasSync = !!card.caldav_uid;
+ pushCardDelete('delete', snapshotCard(card));
+ await api(`api/cards/${card.id}`, { method: 'DELETE' });
+ await window._reloadAll();
+ if (wasSync) window._triggerSync?.();
+ }
}));
grid.querySelectorAll('[data-ctx-color]').forEach(btn => btn.addEventListener('click', async e => { e.stopPropagation(); hideContextMenu(); pushCardEdit('color', card.id, { color: card.color }); await api(`api/cards/${card.id}`, { method: 'PATCH', body: { color: btn.dataset.ctxColor } }); await window._reloadAll(); }));
diff --git a/public/js/modules/detail.js b/public/js/modules/detail.js
index 66bb2b0..550797d 100644
--- a/public/js/modules/detail.js
+++ b/public/js/modules/detail.js
@@ -1015,8 +1015,10 @@ $('detail-done')?.addEventListener('click', async () => {
$('detail-delete')?.addEventListener('click', async () => {
if (!state.viewingCard) return;
- const ok = await showDialog({ title: 'delete_card', message: `"${state.viewingCard.title}" wirklich loeschen?`, danger: true, okLabel: 'delete' });
- if (!ok) return;
+ if (localStorage.getItem('hyprcrd-confirm-delete') !== '0') {
+ const ok = await showDialog({ title: 'delete_card', message: `"${state.viewingCard.title}" wirklich loeschen?`, danger: true, okLabel: 'delete' });
+ if (!ok) return;
+ }
pushCardDelete('delete', snapshotCard(state.viewingCard));
await api(`api/cards/${state.viewingCard.id}`, { method: 'DELETE' });
state.galleryOrigin = null;
diff --git a/public/js/modules/gallery.js b/public/js/modules/gallery.js
index a92149d..67df00b 100644
--- a/public/js/modules/gallery.js
+++ b/public/js/modules/gallery.js
@@ -148,6 +148,7 @@ function openOrphanLightbox(file) {
overlay.querySelector('.orphan-lb-create').addEventListener('click', async () => {
const name = file.url.split('/').pop().replace(/\.[^.]+$/, '');
close();
+ closeGallery();
window._openModal({ id: null, title: name, body: ``, color: '#38bdf8', bucket_id: null });
});
|