TinyMCE Paths, How to specify where to load things like editor_plugin.js

Solution 1:

I had the same issue, and it could have been solved easily if we were able to specify the base url using the document_base_url.

Alternatively, I was able to specify the base url before initializing tinymce.

tinyMCE.baseURL = "URL_TO/tinymce/jscripts/tiny_mce/";// trailing slash important

tinyMCE.init({
        mode : "textareas",
        theme : "simple"
});

TinyMCE is working fine now.

Solution 2:

You can override the base url for tinyMCE by placing the following code before initializing tinyMCE.

var tinyMCEPreInit = {
    suffix: '',
    base: '/tinymce/',
    query: ''
};

This is usefull if you already loaded tinyMCE from a merged source and the base path isn't correctly found.

Solution 3:

According this: http://www.tinymce.com/wiki.php/Configuration:theme_url

tinymce.init({
   ...
   theme_url: (document.location.pathname + '/js/tinymce/themes/modern/theme.js').replace("\/\/", "\/"),
   skin_url:  (document.location.pathname + '/js/tinymce/skins/lightgray/').replace("\/\/", "\/"),
   ...

But, need to be carefull with paths. With help document.location.pathname I've got project root directory. Replace function need for replacing double slash with single slash, because different server can return "...//server/site" OR "...//server/site/" and it can be: "...//server/site/js..." OR "...//server/site//js...".

Solution 4:

If you're using the TinyMCE jQuery plugin, you can load everything from a remote location, just add the script_url parameter into your init code. It will load everything from there, including any scripts/images/etc.

$('textarea').tinymce({
    script_url: 'http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/tiny_mce.js'
});

Check out this fiddle, it's including the whole thing remotely from the TinyMCE website: http://jsfiddle.net/xgPzS/22/