我正在使用elfinder,并且我想通过向上下文菜单添加命令来添加新功能。我在项目的github问题跟踪器上找到了一个解决方案,但是我无法使其工作。这是我做的:向elFinder添加自定义上下文菜单项
var elf;
jQuery().ready(function() {
elFinder.prototype._options.commands.push('editimage');
elFinder.prototype._options.contextmenu.files.push('editimage');
elFinder.prototype.i18.en.messages['cmdeditimage'] = 'Edit Image';
elFinder.prototype.i18.de.messages['cmdeditimage'] = 'Bild bearbeiten';
elFinder.prototype.commands.editimage = function() {
this.exec = function(hashes) {
console.log('hallo');
}
}
elf = jQuery('#elfinder').elfinder({
...
//elfinder initialization
上下文菜单项不显示,在控制台中找不到错误消息。我也尝试在初始化部分的contextmenu - >“files”下放置editimage以防被初始化覆盖。
非常感谢你! – KryDos
这终于挽救了许多小时的实验。想知道为什么elFinder团队不能像这样的答案写这样的doccu。再次感谢。 – jm666
Yp这个技巧。太感谢了! – Gogol