Shapeless dialog fixes

This commit is contained in:
JannisX11 2023-01-17 23:03:58 +01:00
parent 799fea9c1e
commit 67d2c80eb5

View File

@ -814,6 +814,7 @@ window.ShapelessDialog = class ShapelessDialog extends Dialog {
super(id, options); super(id, options);
if (options.build) this.build = options.build; if (options.build) this.build = options.build;
if (options.onClose) this.onClose = options.onClose;
} }
close(button, event) { close(button, event) {
if (button == this.confirmIndex && typeof this.onConfirm == 'function') { if (button == this.confirmIndex && typeof this.onConfirm == 'function') {
@ -824,6 +825,10 @@ window.ShapelessDialog = class ShapelessDialog extends Dialog {
let result = this.onCancel(event); let result = this.onCancel(event);
if (result === false) return; if (result === false) return;
} }
if (typeof this.onClose == 'function') {
let result = this.onClose(event);
if (result === false) return;
}
this.hide(); this.hide();
} }
show() { show() {
@ -839,7 +844,7 @@ window.ShapelessDialog = class ShapelessDialog extends Dialog {
} }
} }
delete() { delete() {
this.object.remove() if (this.object) this.object.remove()
} }
} }
@ -939,7 +944,7 @@ window.MessageBox = class MessageBox extends Dialog {
} }
} }
delete() { delete() {
this.object.remove() if (this.object) this.object.remove()
} }
} }