I want to open elfinder in a new window, like
window.open('path_to_el_finder', '_blank', 'height=520,width=950')
And if I select some file, I want to get it in my input field.
I think it is possible, but I cannot find the solution.
Sorry, already figured out:
$('#elfinder_button').live('click', function() {
$('<div id="editor" />').dialogelfinder({
url : '{{ path('ef_connect') }}',
getFileCallback: function(file) {
$('#editor').dialogelfinder('close');
$('#editor').closest('.elfinder').val(file.path);
console.log($('#editor').closest('.elfinder-input'));
console.log(file.url);
}
});
});
try:
$('<div \>').dialog({modal: true, width: "80%", title: "Select your file", zIndex: 99999,
create: function(event, ui) {
$(this).elfinder({
resizable: false,
url: "path to connector",
commandsOptions: {
getfile: {
oncomplete: 'destroy'
}
},
getFileCallback: function(file) {
document.getElementById('fileurl').value = file;
jQuery('a.ui-dialog-titlebar-close[role="button"]').click();
}
}).elfinder('instance')
}
});
Hi,
Does this code opens elfinder in a modal window ?
Where should I paste this code ?
That would be a good begining for me because i'd like to open elfinder in a modal window using ckeditor.
Thx
I made something so i can put elfinder in a fancybox modal.
Maby the code helps you..
function elFinder()
{
elfinderrel = $('#elfinderselect').attr('rel');
$('#elfinderselect').elfinder(
{
lang: 'nl',
url: 'framework/apps/elfinder/php/connector.php', // connector
urlUpload: 'framework/apps/elfinder/php/connector.php',
uiOptions:
{
// toolbar configuration
toolbar:
[
['back', 'forward'],
['reload'],
['mkdir', 'mkfile', 'upload'],
['open', 'download', 'getfile'],
['info'],
['quicklook'],
['copy', 'cut', 'paste'],
['rm'],
['duplicate', 'rename', 'edit', 'resize'],
['extract', 'archive'],
['search'],
['view']
]
},
commandsOptions:
{
getfile:
{
oncomplete: 'destroy'
}
},
getFileCallback: function(file)
{
console.log(elfinderrel);
returnvalue = elfinderrel;
$('.'+returnvalue).val(file['path']);
$.fancybox.close();
}
}).elfinder('instance');
}
$('#elfinder_button').live('click', function()
{
thisbutton = $(this);
thisbuttonrel = $(this).attr('rel');
$.fancybox({
content: '<div id="elfinderselect"></div>',
afterShow: function()
{
console.log(thisbuttonrel);
$('#elfinderselect').attr('rel', $(thisbutton).attr('rel'));
elFinder();
},
closeBtn: false,
maxWidth: 900,
maxHeight: 700
});
});
is there a way to do this using pure javascript and not by using jQuery?
[email protected] λκ» λ³΄λ΄μ λ©μΌ λ°λ μ¬λμ΄ νμλμ λ©μΌμ μμ μ°¨λ¨ νμμ΅λλ€.
Im sure there is a way to achieve this withouten any Jquery.
I dont know how because i use Jquery all the time.
I dont fancy long JavaScript codes in my projects.
i don't think it will be a long code.. here's an example for the CKFinder
var finder = new CKFinder();
finder.callback = function(api){
api.hideTool('f0');
api.hideTool('f2');
};
finder.selectActionFunction = function(fileUrl){
el.parentElement.children[0].value = fileUrl;
};
finder.popup();
Cool! But i still dont know how to build a modal in pure JS.
It just works with Jquery, you'll have to build it yourself.
it will be fine if it does not using a modal.
[email protected] λκ» λ³΄λ΄μ λ©μΌ λ°λ μ¬λμ΄ νμλμ λ©μΌμ μμ μ°¨λ¨ νμμ΅λλ€.
Most helpful comment
Sorry, already figured out: