mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-28 06:11:48 +00:00
Added a "unsaved changed" warning dialog for part, entity edits and system settings
This fixes issue #1368
This commit is contained in:
parent
ad0c60f766
commit
79c36494ea
21 changed files with 556 additions and 11 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue