forked from psolom/RichFilemanager
-
Notifications
You must be signed in to change notification settings - Fork 0
How to use the Filemanager with tinyMCE 3 or 4
Pavel Solomienko edited this page Feb 10, 2016
·
1 revision
A dedicated page explains how to integrate an external Filemanager to TinyMCE v3.
Few changes are required for TinyMCE 4, please see the code below :
file_browser_callback : function(field_name, url, type, win) {
// from http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
var cmsURL = 'index.html?&field_name='+field_name+'&langCode='+tinymce.settings.language;
if(type == 'image') {
cmsURL = cmsURL + "&type=images";
}
tinyMCE.activeEditor.windowManager.open({
file : cmsURL,
title : 'Filemanager',
width : x * 0.8,
height : y * 0.8,
resizable : "yes",
close_previous : "no"
});
}
Note that field_name
parameter passed into the url is mandatory to return back the value.