Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE how to append baseURL to LINK and base Path for images

I'm using TinyMCE for Editing my site content.

In Local I've different path for my base url and on development server its different and on production its different.

Is there any way to define the something like baseURL for my links and basePath for Images to be linked.

I want to define baseURL to all my links and basePath to my all the Images.

Right now I'm working on my local and I've created few pages. But when I've thought of dev and production It will be difficult to do the path changing task. Please desperately need some solution.

like image 217
Vins Avatar asked Oct 27 '25 00:10

Vins


2 Answers

I think you will need to set these three options:

relative_urls : false,
remove_script_host : false,
document_base_url : "http://www.example.com/path1/"

According to the TinyMCE documentation, this will convert all relative urls to fully qualified URLs, based on the base you provide.

Screenshot of the relevant TinyMCE documentation

like image 162
JosephStyons Avatar answered Oct 28 '25 14:10

JosephStyons


enter image description here

        function myCustomURLConverter(url, node, on_save, name) {
            // Do some custom URL conversion
            if (name == "src")
            {
                url = window.location.origin +"/uploads/" + url
            }
            // Return new URL
            return url;
        }
like image 31
struggleendlessly Avatar answered Oct 28 '25 13:10

struggleendlessly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!