开发者

Problem with insert/update links with tinyMCE

开发者 https://www.devze.com 2022-12-23 23:10 出处:网络
I have a problem with tinyMCE but only on live environment from some reason tinyMCE rewrite absolute url and only for some TLD sites, so far I\'m notice t开发者_JAVA技巧hat it doesn\'t work for .eu do

I have a problem with tinyMCE but only on live environment from some reason tinyMCE rewrite absolute url and only for some TLD sites, so far I'm notice t开发者_JAVA技巧hat it doesn't work for .eu domains, does someone hade a same problem or know what can fix this?


We needed to set both of these options in order to get TinyMCE to stop rewriting URLs to relative paths.

relative_urls : 0
remove_script_host : 0


Although this question has already been answered. I have my own solution and it could be helpful to some others if the accepted answer does not work.

Please see link below for more info.

tinyMCE.init({
    ...
    convert_urls: false,
});

https://www.tiny.cloud/docs/configure/url-handling/#convert_urls


Am I the only person that finds the TinyMCE relative_urls option confusing ?

If you're writing an article/blog post and want to include a ink to a web site other than one you're on, I think the term "absolute URL" describes what you want. You want to put "http://www.somesite.com" and not have TinyMCE put either a forward slash '/' or a relative path '/mysite/' in front of it.

Surprisingly, if you set the following :

tinyMCE.init({
        ...
        relative_urls : false
});

then that's exactly what TinyMCE does :(

But, if you do this :

tinyMCE.init({
        document_base_url : "http://www.somesite.com",
        relative_urls : true
});

Then you seem to get plain, unadulterated links.

Go figure.


I ran into some similar problems with tinyMCE before. It has some strange default behavior with URLs. There are a number of initialization properties you can set that effect how it behaves. Take a look at the documentation and experiment with these properties. At least that's what I did and eventually got the behavior I wanted.

Good luck!


relative_urls: false,
remove_script_host: false,

That will result with URL like http://www.youpage.com/subfolder/file/etc


You can do this

tinyMCE.init({
        ...
    relative_urls : false,
    remove_script_host: true,
});

for more details https://www.tinymce.com/docs/configure/url-handling/#remove_script_host

0

精彩评论

暂无评论...
验证码 换一张
取 消