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.in开发者_如何学Goit" * 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?
Try adding this:
settings['remove_script_host'] = false;
This page might help you to decide what url setting to choose: http://www.tinymce.com/tryit/url_conversion.php
精彩评论