Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tiny mce stopped working after upgrade (modified url)

I was using tiny mce (version 3.2.6) for quite a long time (w/o any problems), but wanted to upgrade it to newer version (3.4.2). The reason of upgrade was some problems with third-party plugin (spellchecker) - after trying with newer version those problems were fixed and on developers env. everything was working ok. The problem occured on live env (after delivering new version of app to client), on client side, you can connect to app (using tiny mce) in two ways:

(1) type address (so normal way, everything works ok)

(2) using some kind of portal - client app, that modifies urls for some reasons I don't know - using this way Tiny mce stopped working after upgrade to (3.4.2). (I've double checked and this is related only with tiny mce version update, not with plugins or other issues).

The way that clients portal converts urls looks like this: non-converted url:

http://server.address/blabla/js/jsFileName.js?v=123

converted url (grabbed from fiddler):

https://client.portal.com/http://server.address/blabla/js/jsFileName.js?v=123&psScriptReferrer=http://server.address/blabla/

As I told before, the 'old' version (3.2.6) was working ok (even with those magically converted urls), problem occured after update tiny mce (no changes to configuration or anything else). The error I'm getting is:

q is not a constructor
https://client.portal.com/http://server.address/blabla/js/tiny_mce/tiny_mce.js?v=123&psScriptReferrer=http://server.address/blabla/
Line 1

(function(d){var a=/^\s*|\s*$/g,e,c="B...{a.selection.onSetContent.add(f)})}});

I get this eror on all browsers (checked on: IE6/IE8/FF3.6). This also results in tiny mce not loaded (only 'plain-html' text input is displayed).

My assumption is that new version included some regexps, and magically converted link contains more than one 'http' string.

I've tried some changes for the following parameters (setting them to 0) - no luck: convert_urls : 1, relative_urls : 1, remove_script_host : 1

it is also one more 'promissing' parameter: document_base_url : tinymce.documentBaseURL

but since this app should be working using two ways described above (1) and (2), I cannot just hardcode the link there (also this sounds like a very fragile solution).

I cannot 100% sure say that this is a bug in tinymce, because using 'normal' address everything works ok. On the other hand, I cannot do anything with those url conversion.

<script type="text/javascript">
    tinyMCE.init({
        mode : "exact",
        elements : "content, contentFr",
        theme : "advanced",
        plugins : "spellchecker",
        spellchecker_languages : "+English=en_CA,French=fr",
        spellchecker_rpc_url : "jmyspell-spellchecker",

        // Theme options
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,fontselect,fontsizeselect,|,forecolor,backcolor,sub,sup",
        theme_advanced_buttons2 : "link,unlink,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,code,|,spellchecker",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",

        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
        theme_advanced_resize_horizontal : 0,
        theme_advanced_path: false,
        content_css : "css/tinyMCE_custom.css",
        oninit: function(){
            tinyMCE.get('content').setContent('some text here');
            tinyMCE.get('contentFr').setContent('some different text here');
        }
    });
    </script>

Thanks for any help/hints.

Regards,

Peter

like image 819
Peter Avatar asked Nov 14 '22 22:11

Peter


1 Answers

I would try upgrading to the current version of TinyMCE, which is 3.4.3.

In the changelog.txt file of that verion there is, among many other bugfixes,

"Fixed bug where exception was thrown in tinymce.util.URI when parsing a relative URI and no base_uri setting was provided."

I am not sure it will solve your problem, but it should be easier with an up-to-date version, because different issues are then less likely to interfere with each other.

like image 96
Luc125 Avatar answered Nov 16 '22 20:11

Luc125