diff --git a/public/index.html b/public/index.html
index 1d0681b..f523b08 100644
--- a/public/index.html
+++ b/public/index.html
@@ -494,7 +494,7 @@
-
+
diff --git a/public/js/diagrams.js b/public/js/diagrams.js
index 93cd89f..4b00c97 100644
--- a/public/js/diagrams.js
+++ b/public/js/diagrams.js
@@ -3,8 +3,6 @@
// Source on the left, live SVG preview on the right. CRUD against
// /api/diagrams. Autosaves on quiet typing like Personal Notes.
// ============================================================
-(function () {
- 'use strict';
var initialized = false;
var mermaidReady = false;
@@ -243,9 +241,7 @@
function onDelete() {
if (currentId == null) return;
var id = currentId;
- var confirmFn = window.showConfirm || function (msg) { return Promise.resolve(window.confirm(msg)); };
- Promise.resolve(confirmFn('Delete this diagram?')).then(function (ok) {
- if (!ok) return;
+ confirmDelete('Delete this diagram?', function () {
fetch('/api/diagrams/' + id, {
method: 'DELETE',
credentials: 'include',
@@ -257,6 +253,14 @@
});
}
+ function confirmDelete(message, onConfirm) {
+ if (window.showConfirm) {
+ window.showConfirm(message, onConfirm, { danger: true, confirmText: 'Delete' });
+ return;
+ }
+ if (window.confirm(message)) onConfirm();
+ }
+
// ── Render ─────────────────────────────────────────────────
function scheduleRender(delay) {
if (renderTimer) clearTimeout(renderTimer);
@@ -394,4 +398,3 @@
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'hidden') flushSaveIfPending();
});
-})();
diff --git a/test/module-entrypoints.test.js b/test/module-entrypoints.test.js
index 88e64bc..829b834 100644
--- a/test/module-entrypoints.test.js
+++ b/test/module-entrypoints.test.js
@@ -7,6 +7,7 @@ const moduleEntrypoints = [
'public/js/calculators.js',
'public/js/clinicalAssistant.js',
'public/js/admin.js',
+ 'public/js/diagrams.js',
'public/js/notes.js',
'public/js/wellVisit.js'
];
diff --git a/test/notes-sanitize.test.js b/test/notes-sanitize.test.js
index fe179ce..7668bd0 100644
--- a/test/notes-sanitize.test.js
+++ b/test/notes-sanitize.test.js
@@ -17,7 +17,7 @@ const assert = require('node:assert/strict');
const { JSDOM } = require('jsdom');
const createDOMPurify = require('dompurify');
-// Match the allowlist used in public/js/notes.js `sanitizeHtml`.
+// Match the allowlist used in public/js/notes/utils.js `sanitizeHtml`.
const ALLOWED_TAGS = ['p','br','strong','em','b','i','u','s','h2','h3','h4',
'ul','ol','li','a','blockquote','code','pre','hr'];
const ALLOWED_ATTR = ['href','target','rel'];