简体   繁体   中英

How to prevent tinyMCE from modifying image URLs in rails

I have a problem with tinyMCE and Image URLs in rails. I inserted the image with this URL:

http://mydomain.com/fold1/fold2/fold3/2010/name.png

and the image is properly inserted. But when I right-click on the image and select insert/edit image , there is this (instead of the URL I pasted):

../../../fold2/fold3/2010/name.png

Since I use this image on more pages, this relative URLs doesn't work for me. I want to set that tinyMCE doesn't modify the URL at all. The URL should be exactly the same, as I write it!

After i did some digging, I believe I should set convert_urls : false inside tinyMCE.init . Am I right? But I am not able to set this.

I looked for tinyMCE.init function inside my rails project with grep -r "tinyMCE.init" * and I found one call of init function inside public/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm file. The call of init function looks like:

tinyMCE.init(settings)

above the call there is this code, which set the settings :

            // Set options
            delete settings.id;
            settings['mode'] = 'exact';
            settings['elements'] = 'fullscreenarea';
            settings['add_unload_trigger'] = false;
            settings['ask'] = false;
            //     settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
            settings['fullscreen_is_enabled'] = true;
            settings['fullscreen_editor_id'] = oeID;
            settings['theme_advanced_resizing'] = false;
            settings['strict_loading_mode'] = true;

            //I ADDED THIS TWO LINES
            settings['convert_urls'] = false;
            settings['relative_urls'] = false;

As you can see I commented out the line with 'document_base_url' and added the last two lines. But this doesn't work. The URLs are stil modifying when I insert them. Can anyone help me with this?

尝试添加以下内容:

settings['remove_script_host'] = false;

该页面可以帮助您决定选择哪种URL设置: http : //www.tinymce.com/tryit/url_conversion.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM