Moodle

drag-and-dropping images in the HTML editor results in loss of absolute URL

Details

  • Affected Branches:
    MOODLE_19_STABLE

Description

ADD a resource / compose a web page
1- In the HTML editor, insert an image (from files in course files) into text. In view code mode the img URL is : <img src="http://localhost/moodle/file.php/2/fish01.gif" />
2- Then, drag and drop this image to a different position. The URL has changed to : <img src="../file.php/2/fish01.gif" />. The image is still visible in the HTML editor.
3- Save and view... The image has disappeared!
4- Edit the resource: the image is still there.

This bug only occurs when using the HTML editor in a add resource/compose web page activity. All the others activities (Glossary, Forum, etc.) are OK.

Diagnostic.
When an image has been dragged and dropped in the HTML editor and its URL has been consequently been changed from absolute to relative:
case #1 in compose web page activity, glossary, etc. the image address in the browser is something liike : http://localhost/moodle/mod/file.php/2/fish01.gif which is WRONG!
case #2 in all other activities, the image address in the browser is something like: http://localhost/moodle/file.php/2/fish01.gif which is CORRECT

Joseph

Activity

Hide
Martin Dougiamas added a comment -

Is this dependent on the browser one is using?

Show
Martin Dougiamas added a comment - Is this dependent on the browser one is using?
Hide
Matthew Davidson added a comment -

Yes, this is not broken in IE. I can easily replicate this error in Firefox.

I have submitted a "starter" fix. I think it probably needs to be improved upon, but it does help. Search for "MDL-13144" to see the code changes.

Show
Matthew Davidson added a comment - Yes, this is not broken in IE. I can easily replicate this error in Firefox. I have submitted a "starter" fix. I think it probably needs to be improved upon, but it does help. Search for "MDL-13144" to see the code changes.
Hide
Matthew Davidson added a comment -

dragend event added

Show
Matthew Davidson added a comment - dragend event added

People

Dates

  • Created:
    Updated: