Rename modal dismissal reason to source, refs #2790

This commit is contained in:
Simon Willison 2026-09-17 15:32:47 -07:00
commit ad1d0bf6f9
4 changed files with 29 additions and 20 deletions

View file

@ -2351,7 +2351,7 @@ function ensureTableCreateDialog(manager) {
updateTableCreateDialogButtons(tableCreateDialogState);
});
modal.beforeClose = function (reason) {
modal.beforeClose = function (source) {
return confirmDiscardTableCreateChanges(tableCreateDialogState);
};
@ -4017,9 +4017,9 @@ function ensureTableAlterDialog(manager) {
}
});
modal.beforeClose = function (reason) {
modal.beforeClose = function (source) {
return (
reason === "cancel" ||
source === "cancel" ||
confirmDiscardTableAlterChanges(tableAlterDialogState)
);
};
@ -7220,9 +7220,9 @@ function ensureRowEditDialog(manager) {
},
);
modal.beforeClose = function (reason) {
modal.beforeClose = function (source) {
return (
reason === "cancel" || confirmDiscardRowEditChanges(rowEditDialogState)
source === "cancel" || confirmDiscardRowEditChanges(rowEditDialogState)
);
};

View file

@ -147,9 +147,9 @@
else initialFocus?.focus();
}
requestClose(reason = "cancel") {
requestClose(source = "cancel") {
if (!this.dialog.open || this.busy) return false;
if (this.beforeClose && this.beforeClose(reason) === false) return false;
if (this.beforeClose && this.beforeClose(source) === false) return false;
this.close();
return true;
}