Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to load an external javascript file inside the tinymce iframe?

Is there a simple way to load external javascript that will work inside of a TinyMCE iframe?

The only thing I've found (that might be the answer) is this: http://www.tinymce.com/wiki.php/API3:class.tinymce.dom.ScriptLoader

But I'm not sure how to load this properly or if it works at all. I tried to load it before and after the tinymce.init directive, even inside it, but nothing seems to work. Just wondering how to intiailize the "ScriptLoader" function.

like image 838
James Nine Avatar asked Sep 12 '12 23:09

James Nine


1 Answers

You may use the scriptloader using the setup init configuration paramter

tinyMCE.init({
   ...
   setup : function(ed) {
      ed.onInit.add(function(ed, evt) {

        // Load a script from a specific URL using the global script loader
        tinymce.ScriptLoader.load('somescript.js');

        // Load a script using a unique instance of the script loader
        var scriptLoader = new tinymce.dom.ScriptLoader();

        scriptLoader.load('somescript.js');

      });
   }
});
like image 84
Thariama Avatar answered Oct 26 '22 05:10

Thariama