Fix submit on close

This commit is contained in:
Dapoolp 2025-06-22 23:43:48 +02:00
parent 6223b05eb1
commit 0d60cd90b6
6 changed files with 27 additions and 6 deletions

View file

@ -22,7 +22,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
actions: {
updateIsAdvantage: this.updateIsAdvantage,
selectExperience: this.selectExperience,
// finish: this.finish
submitRoll: this.submitRoll
},
form: {
handler: this.updateRollConfiguration,
@ -80,6 +80,15 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
this.render();
}
static async submitRoll() {
await this.close({ submitted: true });
}
/** @override */
_onClose(options={}) {
if ( !options.submitted ) this.config = false;
}
static async configure(config={}) {
return new Promise(resolve => {
const app = new this(config);

View file

@ -15,7 +15,9 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
width: 400,
height: 'auto'
},
actions: {},
actions: {
submitRoll: this.submitRoll
},
form: {
handler: this.updateRollConfiguration,
submitOnChange: true,
@ -38,6 +40,15 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
return context;
}
static async submitRoll() {
await this.close({ submitted: true });
}
/** @override */
_onClose(options={}) {
if ( !options.submitted ) this.config = false;
}
static async configure(config={}) {
return new Promise(resolve => {
const app = new this(config);