style(materials): подтверждение удаления через LS.confirm вместо нативного confirm()
Удаление материала и папки теперь показывает стилизованную модалку (LS.confirm, danger) вместо браузерного диалога «Сообщение с localhost». Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -267,7 +267,7 @@
|
|||||||
window.moveMaterial = moveMaterial;
|
window.moveMaterial = moveMaterial;
|
||||||
|
|
||||||
async function delMaterial(id) {
|
async function delMaterial(id) {
|
||||||
if (!confirm('Удалить этот материал?')) return;
|
if (!await LS.confirm('Этот материал будет удалён безвозвратно.', { title: 'Удалить материал?', confirmText: 'Удалить' })) return;
|
||||||
try { await LS.deleteMaterial(id); load(); }
|
try { await LS.deleteMaterial(id); load(); }
|
||||||
catch (e) { LS.toast(e.message || 'Ошибка', 'error'); }
|
catch (e) { LS.toast(e.message || 'Ошибка', 'error'); }
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@
|
|||||||
const content = `<input id="mm-col-name" value="${esc(col.name)}" placeholder="Название папки" style="${FLD}" />`;
|
const content = `<input id="mm-col-name" value="${esc(col.name)}" placeholder="Название папки" style="${FLD}" />`;
|
||||||
const m = LS.modal({ title: 'Папка', content, size: 'sm', actions: [
|
const m = LS.modal({ title: 'Папка', content, size: 'sm', actions: [
|
||||||
{ label: 'Удалить', onClick: async () => {
|
{ label: 'Удалить', onClick: async () => {
|
||||||
if (!confirm('Удалить папку? Материалы останутся (станут «Без папки»).')) return;
|
if (!await LS.confirm('Материалы из неё останутся и станут «Без папки».', { title: 'Удалить папку?', confirmText: 'Удалить' })) return;
|
||||||
try { await LS.deleteMaterialCollection(id); m.close(); if (_filter.col === String(id)) _filter.col = 'all'; load(); }
|
try { await LS.deleteMaterialCollection(id); m.close(); if (_filter.col === String(id)) _filter.col = 'all'; load(); }
|
||||||
catch (e) { LS.toast(e.message || 'Ошибка', 'error'); }
|
catch (e) { LS.toast(e.message || 'Ошибка', 'error'); }
|
||||||
} },
|
} },
|
||||||
|
|||||||
Reference in New Issue
Block a user