Ticket #1847 (closed Bug: invalid)

Opened 6 months ago

Last modified 6 months ago

Drag picture in Mozilla trashes src

Reported by: dinu Owned by:
Priority: Normal Milestone:
Component: General Version: FCKeditor 2.5.1
Keywords: Confirmed Firefox Cc:

Description

In mozilla, if you drag an image around, the src changes from url to ../../url; problem if you use absolute urls for images (/path/to/image) it changes to (../../path/to/images) or a base url for the editor and the image disappears. Going to source view and back again, the good src is restored, presumably from _fcksavedurl.

Attachments

fckbug.png (16.9 kB) - added by dinu 6 months ago.
Screenshot

Change History

Changed 6 months ago by w.olchawa

  • keywords Pending WorksForMe added

Hi!

I couldn't reproduce your bug. I was dragging images inside the editors text and tables and the links remained the same. Could you please write a step by step instruction to reproduce your bug.

Thanks!

Changed 6 months ago by dinu

Hi, Ok, so here's a list of stept to reproduce the bug: 1) FCK latest from SVN or 2.5.1 or previous release, same behavior 2) Firefox 2.0.0.12 (latest), same behavior on older browser 3) Insert an image in the text 4) Drag the image to another position in the text 5) Open firebug, dom explorer, whatever, look at the img src attribute

I attach a screenshot with firebug, with the problem underlined.

Dinu

Changed 6 months ago by dinu

Screenshot

Changed 6 months ago by martinkou

  • keywords Confirmed Firefox added; Pending WorksForMe removed

Confirmed.

This may be caused by the same underlying issue as in #193 which I'm investigating.

Changed 6 months ago by dinu

Don't know if this helps, but here's an odd thing: the ../../.... src seems to point right whenever a baseUrl isn't specified, so I did the following thing trying to get the logic of this: I tried to load the whole page in an iframe, javascript generated (point being that window has no location). Now the url always changes to ../.. (always twice back, not anymore related to the location or anything). Failed to find any logic... bailing out ;)

Changed 6 months ago by fredck

  • status changed from new to closed
  • resolution set to invalid

This is a known thing with Firefox and that's the reason why we have the _fcksavedurl attribute, so we use that value when outputting the editor data.

In other words, the editor will not output the wrong value, just the original one. If you are looking for using the DOM to manipulate the editor contents, then you must look for the fcksavedurl attribute.

Changed 6 months ago by dinu

I'm not trying to manipulate the editor contents, I just use a setup with mod_rewrite and baseUrl where obviously ../.. dowsn't map the same way as / and so firefox users get disappearing images when dragging.

Changed 6 months ago by fredck

dinu, I didn't understand it. As far as I know, relative URLs are resolved in the browser. The server always receive the request for the full URL, so I don' see how mod_rewrite can be impacted here.

Anyway, this is a strong browser limitation we have faced in the past, and the _fcksavedurl came to make it work... and worked well so far.

Changed 6 months ago by dinu

Here's in more detail:
- the script resides at http://server/path/to/script[[BR]] - it has uploaded files at http://server/path/to/script/Upload[[BR]] - it uses mod_rewrite to serve virtual addresses such as http://server/path/to/script/virtual/page/address[[BR]] - in FCKeditor, I set FCKConfig.BaseHref='http://server/path/to/script'[[BR]] - now, when editing, if I insert a picture it has the url Upload/image/picture.ext
- when I drag the picture around, the URL changes to ../../Upload/image/picture.ext, which is mapped to http://server/path/Upload/image/picture.ext (to/script/ missing)
- as a result, picture disappears

So the problem is not mod_rewrite, but the fact that FF maps relative urls wrong when having <base href="...">. I think this will always be a problem when using BaseHref in FF, so it's more that a weird instance bug, it breaks the whole BaseHref feature in FF. I took a look at the code, and saw that it's easy to tell when an internal drag operation occurs (FCK.MouseDownFlag in FCK.InitializeBehaviors._ExecDrop), so I wonder if restoring urls from _fcksavedurl at this point would be a cheap fix to this?

Note: See TracTickets for help on using tickets.