Added a "unsaved changed" warning dialog for part, entity edits and system settings

This fixes issue #1368
This commit is contained in:
Jan Böhmer 2026-05-25 21:29:10 +02:00
parent ad0c60f766
commit 79c36494ea
21 changed files with 556 additions and 11 deletions

View file

@ -102,7 +102,18 @@ export default class extends Controller {
onNodeSelected: (event) => {
const node = event.detail.node;
if (node.href) {
window.Turbo.visit(node.href, {action: "advance", frame: this._frame});
const url = node.href;
// Turbo.visit with a frame target bypasses turbo:before-visit, so dispatch it
// manually so that dirty-form guards can intercept it.
const beforeVisitEvent = new CustomEvent('turbo:before-visit', {
bubbles: true,
cancelable: true,
detail: { url, frame: this._frame },
});
document.dispatchEvent(beforeVisitEvent);
if (!beforeVisitEvent.defaultPrevented) {
window.Turbo.visit(url, {action: "advance", frame: this._frame});
}
}
},
}, [BS5Theme, BS53Theme, FAIconTheme]);