You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Typescript types specify that a Content Dialog's handler function must return a Promise<void>, in addition to accepting the resolve/reject arguments.
This function lets you use your own logic to retrieve the desired value.
Once the value is available, you must call the resolve(value) function to pass it to the editor.
In case you want to cancel the operation, call the reject() function.
A resolve or reject call is mandatory. If you miss this step, the editor will remain in waiting mode.
Error management on the host application must call the reject function to unblock the editor.
The documentation gives several examples, none of which return anything from the handler method:
contentDialog: {
filePicker: {
handler: function(resolve, reject) {
resolve({
url: 'string', // url to the file (e.g. http://www.example.com/myimage.jpg)
})
}
},
specialLinks: {
label: 'Custom text for links',
handler: function(resolve, reject) {
openMySpecialLinkDialog() // Replace this with your application function
.then(specialLink => resolve(specialLink))
.catch(() => reject())
}
},
}
The text was updated successfully, but these errors were encountered:
The Typescript types specify that a Content Dialog's
handler
function must return aPromise<void>
, in addition to accepting theresolve
/reject
arguments.https://github.com/BEE-Plugin/Bee-plugin-official/blob/083ec76fd013087b8324703a55f01bcfe273e8fe/src/types/bee.ts#L286-L291
Returning a pending/resolve/rejected Promise seems to produce no effect,
The documentation doesn't mention a return value.
Isn't the
handler
just used as the function passed tonew Promise(handler)
? If it is, the return value ofhandler
would be ignored.Documentation
The Content Dialog documentation describes the
handler
method as follows:The documentation gives several examples, none of which return anything from the
handler
method:The text was updated successfully, but these errors were encountered: