mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
Page:
Integration with TinyMCE 4.x
Pages
3rd party connectors, plugins, modules
Adding file description to Properties dialog 2.1
Adding file description to Properties dialog
Adding new column to list view in 2.1
Advisory about vulnerability of CVE 2018 9109 and CVE 2018 9110
Automatically load language
Basic Authentication Example
Build and compress elFinder from source
Client Server API 2.0
Client Server API 2.1
Client configuration options 2.1
Client configuration options
Client event API
Common issues
Connector configuration options 2.1
Connector configuration options
Create dialog with custom context menu command
Custom context menu command
Custom search function
Disable real file path from being shown
Getting encoded hash from the path
HOWTOs by external sites
Home
How to get OAuth token
How to load CSS with RequireJS
Install
Integration with CKEditor (jQuery UI dialog mode) Varian 2 (change url)
Integration with CKEditor (jQuery UI dialog mode)
Integration with CKEditor 4 (jQuery UI dialog mode)
Integration with CKEditor 4
Integration with CKEditor 5
Integration with CKEditor
Integration with CodeIgniter
Integration with Codeigniter 2
Integration with Multiple Summernote (fixed functions)
Integration with TinyMCE 3.x
Integration with TinyMCE 4.x
Integration with elRTE 1.x
Logging
Multiple Roots
Node.js connector
Simple file permissions control
Using custom editor to edit files within elfinder
Using elFinder 2.x UI with 1.x connector
Using toast() to display popup notifications in 2.1
Clone
27
Integration with TinyMCE 4.x
Naoki Sawada edited this page 2019-01-28 09:44:30 +09:00
NEWS: It is easier to integrate using the tinymceElfinder integrator. It supports TinyMCE 4 and 5.
The following is the previous integration method.
Configure TinyMCE 4.x to use the elFinder file manager
In the TinyMCE init code, add the following line:
plugins: "image, link, media", // example
toolbar: "link image media", // example
file_picker_callback : elFinderBrowser
Then add the following function (change the elfinder_url to the correct path on your system):
function elFinderBrowser (callback, value, meta) {
tinymce.activeEditor.windowManager.open({
file: '/elfinder/elfinder.html',// use an absolute path!
title: 'elFinder 2.1',
width: 900,
height: 450,
resizable: 'yes'
}, {
oninsert: function (file, fm) {
var url, reg, info;
// URL normalization
url = fm.convAbsUrl(file.url);
// Make file info
info = file.name + ' (' + fm.formatSize(file.size) + ')';
// Provide file and text for the link dialog
if (meta.filetype == 'file') {
callback(url, {text: info, title: info});
}
// Provide image and alt text for the image dialog
if (meta.filetype == 'image') {
callback(url, {alt: info});
}
// Provide alternative source and posted for the media dialog
if (meta.filetype == 'media') {
callback(url);
}
}
});
return false;
}
Update the elFinder page being called by TinyMCE 4.x
Copy main.default.js to main.mce.js And edit a part opts = {...},. Or download main.mce.js.
opts = {
getFileCallback : function(file, fm) {
// pass selected file data to TinyMCE
parent.tinymce.activeEditor.windowManager.getParams().oninsert(file, fm);
// close popup window
parent.tinymce.activeEditor.windowManager.close();
},
url : 'php/connector.minimal.php', // connector URL (REQUIRED)
lang: lang // auto detected language (optional)
},
Edit elfinder.html a part main.default.cke.js to main.mce.js
<script data-main="./main.mce.js" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js"></script>