The app I develop is a reader and editor for a particular type of file. When I modified the “register file action” section for version 28 (following the guide), I managed to get everything working except the file icon and alt text: the icon is the default cogwheel, and the alt text still reads “Download [file]” instead of “Open in editor” like it should. Is there anything I’m missing that might be the reason? I looked, but I can’t seem to find anyone else’s examples where it works.
I’ve also seen a section of the instructions that explains how to set up mimetypes, but appears to only work on a per-instance basis.
This is my code:
registerFileAction(new FileAction({
id: ext,
displayName() {
return 'Open in ' + ext.toUpperCase() + ' Editor'
},
enabled(nodes) {
return nodes.length === 1 && attr.mime === nodes[0].mime && (nodes[0].permissions & OC.PERMISSION_READ) !== 0
},
iconSvgInline: () => attr.icon,
async exec(file, view) {
if (!window.OC.getCurrentUser().uid) {
alert("Not yet implemented.");
return false;
} else {
var dirName = file.dirname;
var url = OC.generateUrl('/apps/' + 'files_bpm/?' + 'dir=' + dirName + '&fileId='+file.fileid);
window.location.href = url;
return true;
}
},
default: DefaultType.HIDDEN
}));
//attr has the form:
/*bpmn: {
mime: 'application/x-bpmn',
type: 'text',
css: 'icon-filetype-bpmn',
icon: require('!!svg-inline-loader!./../img/icon-filetypes_bpmn.svg')
newStr: 'New BPMN File',
}*/