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