Hi all, I am having some problems understanding how fckeditor is handling the urls on images that are dragged and dropped into the editing area.
When I drag an image in using internet explorer I wind up with <img src="http://domain-name/public/foo.gif">
When I drag the same image in using firefox I get <img src="../../public/foo.gif">
All I want is "/public/foo.gif"
I have set the BaseHref attribute to all sorts of things and it seems to have no effect to me.
Any ideas on how to fix it?
Sat, 12/03/2005 - 19:58
#1
RE: relative urls on drag n drop images
RE: relative urls on drag n drop images
I have the same problem in MSIE6 with the domain name being added to relative URLs on drag-drop.
You can test this at the default editor
http://www.fckeditor.net/demo/default.html
insert the image
"/images/logotop.gif"
which is the logo at the top of the page. Drag-Drop it and then open the source code. It has become ...
"http://www.fckeditor.net/images/logotop.gif"
this is a real pain as I'm using a subdomain to edit the websites. Also backup copies or cd copies of the website won't work !
RE: relative urls on drag n drop images
This problem has been labeled as fixed by Frederico Caldeira Knabben in bug report ...
[ 1165914 ] Relative urls become absolute when copy paste
http://sourceforge.net/tracker/?func=de ... p_id=75348
I presume it will be available in next release (current 2.1.1).
In the meantime I've switched to stripping these unwanted prefixes by using server side regexes ...
' Fix domain level absolute links (generated by FCKeditor when images/links are drop/dragged
' 1. http://localhost/fckeditor/editor/
RegularExpressionObject.Pattern = "http://localhost/fckeditor/editor/"
NewContent = RegularExpressionObject.Replace(NewContent, "/")
' 2. http://localhost/
RegularExpressionObject.Pattern = "http://localhost/"
NewContent = RegularExpressionObject.Replace(NewContent, "/")
' 3. http://admin.domain.com/fckeditor/editor/
RegularExpressionObject.Pattern = "http://admin.[^/]*/fckeditor/editor/"
NewContent = RegularExpressionObject.Replace(NewContent, "/")
' 4. http://admin.domain.com/
RegularExpressionObject.Pattern = "http://admin.[^/]*/"
NewContent = RegularExpressionObject.Replace(NewContent, "/")