Disable TinyMCE absolute to relative URL Conversions

tinymce relative_urls
tinymce relative urls problem
tinymce link url
absolute url for image
tinymce textarea
tinymce disable toolbar
tinymce toolbar
tinymce documentation

Can anyone tell me how to get TinyMCE to stop converting my URLs to relative links in Plone?

For example, if I enter this in the HTML source:

<img src="/images/dir/subdir/my_image.png" />

it will convert it to:

<img src="../../../my_image.png" />

I've edited tiny_mce.js (in portal_skins) to set:

convert_urls:false,
relative_urls:false,

but to no effect. I've read all similar posts here, but none really answer this question.

It's fine if it does the relative thing when users are picking images by browsing the filesystem (i.e. the catalog). I just want it to respect what I type in the html box ... so that I have the option of forcing an absolute path if I deem it appropriate. This is the standard behavior in kupu.

Any ideas?

Set convert_urls: false in tiny_mce_init.js, not tiny_mce.js. Early in tiny_mce_init.js you'll see a call to window.tinyMCE.init passing a bunch of initialisation options. In the Products.TinyMCE I'm looking at, the last option is fix_list_elements: false. Add your option there.

Edit: tiny_mce_init.js is no longer used in Products.TinyMCE 1.3.x (Plone 4.3). Instead, override the tinymce-jsonconfiguration browser view, e.g.:

Assuming you have a package with a browser layer, add in browser/configure.zcml:

<browser:page
    for="*"
    name="tinymce-jsonconfiguration"
    class=".tinymce.TinyMCEBrowserView"
    permission="zope2.View"
    attribute="jsonConfiguration"
    layer="..interfaces.IMyBrowserLayer"
    />

Then add browser/tinymce.py:

try:
    import simplejson as json
except ImportError:
    import json

from Acquisition import aq_inner
from Products.CMFCore.utils import getToolByName
from Products.TinyMCE.browser.browser import TinyMCEBrowserView as View
from Products.TinyMCE.browser.interfaces.browser import ITinyMCEBrowserView
from zope.interface import implements


class TinyMCEBrowserView(View):
    implements(ITinyMCEBrowserView)

    def jsonConfiguration(self, field):
        """Return the configuration in JSON"""

        utility = getToolByName(aq_inner(self.context), 'portal_tinymce')
        config = utility.getConfiguration(context=self.context,
                                          field=field,
                                          request=self.request)
        config['convert_urls'] = False
        return json.dumps(config)

plone, Set convert_urls: false in tiny_mce_init.js, not tiny_mce.js. Early in tiny_mce_init.​js you'll see a call to window.tinyMCE.init passing a bunch of initialisation  convert_urls. This option enables you to control whether TinyMCE is to be smart and restore URLs to their original values. URLs are automatically converted (messed up) by default because the browser’s built-in logic works this way. There is no way to get the real URL unless you store it away.

You should add these configs into tinymce.int:

relative_urls: false,

convert_urls: false,

remove_script_host : false,

URL handling options, Q: How do I convert my URLs to relative, absolute, or absolute with domain? Relative URLs To disable the bottom anchor from the drop down set it false . URL conversion example You can read more about these config options in the TinyMCE FAQ. Absolute URLs on links and images. Relative URLs on links and images.

An other solution is to configure TinyMCE with the control panel to use UID for every links and images, instead of path, so you don't modify any existing javascripts and don't have any relative url displayed.

URL Handling, Q: How do I convert my URLs to relative, absolute, or absolute with domain? This is disabled by default for security purposes so scripts can't be injected by  To disable that feature I think one has to add a setting for tinyMCE init. " Go into your /modules directory and access the /TinyMCE directory where you have installed the TinyMCE module. There edit the file tinyconfig.php, search for the line that reads relative_urls : "true" (line 101 in version 2.2.5 of the TinyMCE basic module) and set it

In Plone 5 is possible disable TinyMCE absolute to relative URL adding variables in Advanced tab of TinyMCE Settings

Site setup > TinyMCE > Advaced

{"relative_urls": false, "convert_urls": false, "remove_script_host": false}

Further variables are available in Products/CMFPlone/static/components/tinymce-builded/js/tinymce/tinymce.js

...
popup_css: '',
plugins: '',
document_base_url: documentBaseUrl,
add_form_submit_trigger: true,
submit_patch: true,
add_unload_trigger: true,
convert_urls: true,
relative_urls: true,
remove_script_host: true,
object_resizing: true,
...

URL conversion example, Some relative urls: content. TinyMCE Logo. Some absolute urls: content. TinyMCE Logo. p. It should be able to convert "internal:node/23" into either a relative or absolute URL. As mentioned before, I think there are many other cases where TinyMCE should not munge the URL at all. And if you enter and use absolute URLs in your contents, that's not the fault of the editor.

How do I stop TinyMCE from replacing absolute links with root , In TinyMCE, if I specify a link with the domain name and the domain name happens to be what Drupal was How do I stop TinyMCE from replacing absolute links with root-relative links? Anybody know how I can keep TinyMCE from rewriting absolute links it thinks are local? To disable converting url, Problem is, when I insert images from the same site, TinyMCE will use relative url to the image instead of the fixed url I entered when including the image. The resulting html is used elsewhere, for example in emails. Problem is, relative urls will not show up properly anywhere but in the original location.

tinyMCE converts relative urls to absolute [#442722], When I enter a relative url TinyMCE converts it to an absolute one. How can I disable this? should contain and use the configuration option "convert_urls" = FALSE, which means that the editor won't convert any URLs at all. How do I stop TinyMCE from replacing absolute links with root-relative links? By smithaa02 on 22 May 2007 at 15:21 UTC In TinyMCE, if I specify a link with the domain name and the domain name happens to be what Drupal was installed on, TinyMCE thinks it will be clever by getting rid of the domain name and protocol.

Moodle in English: tinyMCE converts relative urls to absolute, When I enter a relative url TinyMCE converts it to an absolute one. How can I disable this? Please On the internet, there is a system (DNS) for converting symbolic names like my.moodle.site to the appropriate IP address. When I enter a relative url TinyMCE converts it to an absolute one. How can I disable this? I know that there is a configuration setting for tinyMCE_init called relative_urls=false.

Comments
  • Possible duplicate of Get TinyMCE to use full image url instead of relative one
  • Thanks, Dan. That did it. There are three settings that you can adjust to control URL handling. They are convert_urls, relative_urls and remove_script_host. By adjusting those settings, you can probably get the behavior you want. Those variables are not in tiny_mce_init.js so -- like you said -- you have to add them.
  • Don't forget to "accept" answers as correct to ensure the answerer gets their "karma points" and that the question is closed.