I am trying to implement a confirmation dialog for when a user goes to close an event that they have written some values into.
Both the dialog I'm trying to use (https://www.npmjs.com/package/material-ui-confirm) as well as the Bryntum MessageDialog (https://bryntum.com/products/calendar/docs/api/Core/widget/MessageDialog#function-confirm) require marking the method as async to await the users decision.
Unfortunately the Popup beforeClose
listener does not seem to be awaiting the result of async functions.
Reproducible minimal example using https://bryntum.com/products/calendar/examples/eventedit/ ...
This works and prevents the event editor from closing.
eventEdit : {
editorConfig : {
listeners: {
beforeClose: ({ source }) => {
return false;
}
}
},
This doesn't work. The editor closes.
eventEdit : {
editorConfig : {
listeners: {
beforeClose: async ({ source }) => {
return false;
}
}
},
This pops the dialog as expected but the event editor gets closed
eventEdit : {
editorConfig : {
listeners: {
beforeClose: async ({ source }) => {
const result = await MessageDialog.confirm({
title : 'Please confirm',
});
return result === MessageDialog.yesButton;
}
}
},
Any advice or workarounds would be greatly appreciated. This also seems like a good candidate for an integrated feature, optional confirmation dialogs before dismissing event editors (see Google Calendar for example).