I am using the below code for creating and acting on a Save Dialog in OSjs.
core.make('osjs/dialog', 'file', {type: 'save', title: "Save As"}, {parent: win, attributes: {modal: true}}, (status, file, event) => {
if (status === "ok") {
if (!file.path.endsWith(".wf"))
file.path += ".wf";
basic.emit('save-file', file);
}
});
And the resulting Dialog:
At this point, I would expect clicking the Cancel button to trigger a callback with status = 'cancel' and file = null. However the Cancel button callback doesn't trigger until Filename is populated with some text.
There also appears to be an error handler that triggers if the text equals an existing filename, even if the Cancel button was pressed and not the OK button, example below:
Pressing No returns to the Save Dialog, and pressing Yes on the Confirm window closes the Save Dialog and sends the status = 'cancel' callback.
I believe expected behavior is to not display the Confirm dialog when Cancel is pressed and to simply close the Save Dialog while sending the 'cancel' callback, regardless of whether any text is input in the Filename field.
Thanks Anders, you're the man.