I am trying to integrate elFinder and TinyMCE using the advanced method found here: https://github.com/Studio-42/elFinder/wiki/Integration-with-TinyMCE-4.x
When I click the image icon in TinyMCE, elFinder will appear in a popup window, and when I double click on a file in elFinder, it should include it in the editor.
However, the following code causes some error I can't figure out.
<script src="//tinymce.cachefly.net/4.2/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea",
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
autosave_ask_before_unload: false,
file_picker_callback : elFinderBrowser
});
function elFinderBrowser (field_name, url, type, win) {
tinymce.activeEditor.windowManager.open({
file: '<?=url('/');?>staff/elfinder/',// use an absolute path!
title: 'elFinder 2.0',
width: 900,
height: 450,
resizable: 'yes'
}, {
oninsert: function (file) {
// Provide file and text for the link dialog
if (meta.filetype == 'file') {
// callback('mypage.html', {text: 'My text'});
callback(file.url);
}
// Provide image and alt text for the image dialog
if (meta.filetype == 'image') {
// callback('myimage.jpg', {alt: 'My alt text'});
callback(file.url);
}
// Provide alternative source and posted for the media dialog
if (meta.filetype == 'media') {
// callback('movie.mp4', {source2: 'alt.ogg', poster: 'image.jpg'});
callback(file.url);
}
}
});
return false;
}
</script>
The error shown in the browser console is ReferenceError: Can't find variable: meta. Can someone help me figure out or troubleshoot this error?