Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

TinyMCE plugin, get url to correct tiny_mce_popup.js?

Vote:
 

Hi,

I'm making a tinymce button plugin which opens a popup. I the popup i can reference tiny_mce_popup.js with (just like epi's plugins)

but that loads the tiny_mce_popup.js for tinymce 3.3.9.3 (at least thats the version that tiny_mce_src.js says it is) which is located at path /Util/Editor/tinymce/. I want the file in at /EPiServer/CMS/9.9.0.0/Util/Editor/tinymce/ (or what ever version of the CMS module i have) which is version 3.5.11.

How can i get the correct url?

#154939
Sep 02, 2016 15:00
Vote:
 

So, i solved it with my own dependency loading, like this:

        (function () {
            var dependencies = ['/tiny_mce_popup.js', '/utils/form_utils.js'];
            var left = dependencies.length;
            var tinymce = ((!window.frameElement && window.dialogArguments) || opener || parent || top).tinymce;
            for (var i = 0; i < dependencies.length; ++i) {
                var dependency = dependencies[i];
                var script = document.createElement('script');
                script.src = tinymce.baseURL + dependency;
                script.onload = function () {
                    console.log(script.src,'loaded',left)
                    if (--left == 0) {
                        tinyMCEPopup.onInit.add(SimpleImage.init, SimpleImage);
                    }
                }
                document.head.appendChild(script);
            }
        })();

SimpleImage is my "popup controller".

#154941
Edited, Sep 02, 2016 15:55
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.