fixes
This commit is contained in:
1 parent
cd9dc3e5bc
commit
5aa3abc860
4 files changed
+18
-1
No files matched your search
@@ -139,9 +139,11 @@ $('select-tag')?.addEventListener('click', async () => {
|
|||||||
|
|
||||||
$('select-delete')?.addEventListener('click', async () => {
|
$('select-delete')?.addEventListener('click', async () => {
|
||||||
if (!selectedIds.size) return;
|
if (!selectedIds.size) return;
|
||||||
|
if (localStorage.getItem('hyprcrd-confirm-delete') !== '0') {
|
||||||
const { showDialog } = await import('./dialog.js');
|
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' });
|
const ok = await showDialog({ title: 'delete cards', message: `${selectedIds.size} card${selectedIds.size > 1 ? 's' : ''} loeschen?`, danger: true, okLabel: 'delete' });
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
}
|
||||||
for (const id of selectedIds) {
|
for (const id of selectedIds) {
|
||||||
await api(`api/cards/${id}`, { method: 'DELETE' });
|
await api(`api/cards/${id}`, { method: 'DELETE' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(); }
|
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 === '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(); }));
|
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(); }));
|
||||||
|
|||||||
@@ -1015,8 +1015,10 @@ $('detail-done')?.addEventListener('click', async () => {
|
|||||||
|
|
||||||
$('detail-delete')?.addEventListener('click', async () => {
|
$('detail-delete')?.addEventListener('click', async () => {
|
||||||
if (!state.viewingCard) return;
|
if (!state.viewingCard) 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' });
|
const ok = await showDialog({ title: 'delete_card', message: `"${state.viewingCard.title}" wirklich loeschen?`, danger: true, okLabel: 'delete' });
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
}
|
||||||
pushCardDelete('delete', snapshotCard(state.viewingCard));
|
pushCardDelete('delete', snapshotCard(state.viewingCard));
|
||||||
await api(`api/cards/${state.viewingCard.id}`, { method: 'DELETE' });
|
await api(`api/cards/${state.viewingCard.id}`, { method: 'DELETE' });
|
||||||
state.galleryOrigin = null;
|
state.galleryOrigin = null;
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ function openOrphanLightbox(file) {
|
|||||||
overlay.querySelector('.orphan-lb-create').addEventListener('click', async () => {
|
overlay.querySelector('.orphan-lb-create').addEventListener('click', async () => {
|
||||||
const name = file.url.split('/').pop().replace(/\.[^.]+$/, '');
|
const name = file.url.split('/').pop().replace(/\.[^.]+$/, '');
|
||||||
close();
|
close();
|
||||||
|
closeGallery();
|
||||||
window._openModal({ id: null, title: name, body: ``, color: '#38bdf8', bucket_id: null });
|
window._openModal({ id: null, title: name, body: ``, color: '#38bdf8', bucket_id: null });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user