I’m using the new widget api to add a download button to the post menu. The button renders correctly but my action is not called. What am I doing wrong? I am attach an action in the same initializer as I am adding the button as following.
withPluginApi('0.1', api => {
api.addPostMenuButton('download', (post) => {
if (post.upload_url) {
return {
action: 'downloadFile',
icon: 'download',
className: 'download-file',
title: 'files.download',
position: 'first'
};
}
});
api.attachWidgetAction('post', 'downloadFile', function() {
const post = this.model;
const upload_url = post.get('upload_url');
return upload_url;
});
});
I get the following error.
WARNING: downloadFile not found