-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Custom context menu command
Sergey B (Troex Nevelin) edited this page May 5, 2016
·
8 revisions
Added from #257
Another example http://stackoverflow.com/questions/16604842/adding-a-custom-context-menu-item-to-elfinder/
To add a custom command you must follow this steps:
$().ready(function() {
var elf = $('#elfinder').elfinder({
url : 'php/connector.php',
commands : [
'custom','open', 'reload', 'home', 'up', 'back', 'forward', 'getfile', 'quicklook',
'download', 'rm', 'duplicate', 'rename', 'mkdir', 'mkfile', 'upload', 'copy',
'cut', 'paste', 'edit', 'extract', 'archive', 'search', 'info', 'view', 'help', 'resize', 'sort', 'netmount'
],
contextmenu : {
// navbarfolder menu
navbar : ['open', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'info'],
// current directory menu
cwd : ['reload', 'back', '|', 'upload', 'mkdir', 'mkfile', 'paste', '|', 'sort', '|', 'info'],
// current directory file menu
files : ['getfile', '|', 'custom', 'quicklook', '|', 'download', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'edit', 'rename', 'resize', '|', 'archive', 'extract', '|', 'info']
},
}).elfinder('instance');
});
'cmdcustom' : 'Custom command',
3) create a custom command file(you can copy an existing command from source) and include it in your main html
elFinder.prototype.commands.custom= function() {
this.exec = function(hashes) {
//implement what the custom command should do here
}
}
.elfinder-button-icon-custom { /* css here */ }