Open ejeanneaubc opened 8 years ago
in standalonepopup.js
jQuery(document).ready(function($) { <-- no coding like this
$(document).on('click','.popup_selector',function (event) {
event.preventDefault();
var updateID = $(this).attr('data-inputid'); // Btn id clicked
var elfinderUrl = '/elfinder/popup/';
var triggerUrl = elfinderUrl + updateID;
$.colorbox({
href: triggerUrl,
fastIframe: true,
iframe: true,
width: '70%',
height: '50%'
});
});
}); <-- no coding like this
// function to update the file selected by elfinder
function processSelectedFile(filePath, requestingField) {
$('#' + requestingField).val(filePath).trigger('change');
}
Thank's but when i remove the jquery ready, i have this :
standalonepopup.js:8 Uncaught TypeError: $.colorbox is not a function
When i click on my link to open elFinder Browser with colorbox
<script type="text/javascript" src="/assets/js/jquery.colorbox-min.js"></script>
this source exist in js folder?
Yes absolutely.
Anyone have other idea please ?
Edit your js script in \resources\views\vendor\standalonepopup.php
<script type="text/javascript">
$(document).ready(function () {
var elf = $('#elfinder').elfinder({
// set your elFinder options here
height: 550,
lang: 'vi', // locale
customData: {
_token: 'sonkj1Hfl8YTvrHXwZzJVMhW1ejFBKJR7hGNpN8f'
},
url: 'http://laravel/admin/filemanager/connector', // connector URL
soundPath: 'http://laravel/packages/barryvdh/elfinder/sounds',
dialog: {width: 900, modal: true, title: 'Select a file'},
resizable: false,
onlyMimes: ['image'],
commandsOptions: {
getfile: {
oncomplete: 'destroy'
}
},
getFileCallback: function (file) {
window.parent.processSelectedFile(file.path, 'feature_image');
}).fadeIn('slow');
// Close colorbox
parent.$.colorbox.close();
}
}).elfinder('instance');
</script>
Try it
Try a standalone window, without colorbox, modals etc. simple browser window https://goo.gl/4YyP3J
Hi !
I have a problem with the standalone integration of elFinder.
I have my standalonepopup.js
If i don't use document ready like the standalonepopup originaly js file i've got an $.colorbox is undefined error.
When i click on my media in the popup i have this javascript error :
This :
parent.jQuery.colorbox.close();
seems to not workingHere my html template :
Have you got an idea please ?
Thank's a lot !
Emmanuel.