Moodle

CLONE -hyperlinking an Image using the HTML Editor does not work.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.8
  • Fix Version/s: None
  • Component/s: HTML Editor
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE

Description

Hyperlinking an image using the html editor gives strange behaviour using different browsers.....

In Firefox (I'm using 1.0.7), try this.

insert an image, give it a useful alt text - eg "image"
then make sure the image is selected and use the hyperlink button to create a hyperlink for the image.
for the hyperlink title use some useful text like "URL" - then hit ok.
Instead of creating a hyperlink, in Firefox, the Image disapears, however the image alt text appears in place of the image as "text" (If that makes sense!)

In IE 6 you get a JS error like mentioned here:
http://moodle.org/mod/forum/discuss.php?d=55696

In IE 7 (Beta 2) you don't get a JS error, but when you try to add a link to an image, the insert Link window doesn't do anything when you hit "OK" - it just sits there, and makes no changes to the underlying window (this is possibly just an IE 7 quirk, - might be improved in the next version....) - I'll upgrade to RC 1 to see If I can get any more debug info out! ( I will upgrade FF as well to see if that makes any difference.

Issue Links

Activity

Hide
Sam Marshall added a comment -

This problem still occurs in current Moodle HEAD as well as in the initially quoted version (1.6.4). Probably it also affects all versions in between.

I changed priority to 'major'; it's really somewhere between minor and major... yes, there's a workaround (go into source view and type in the link code manually) but it's not a workaround we can really expect users to carry out, and also this does result in minor dataloss in that the image you've inserted disappears and you have to insert it again.

I don't think I'm volunteering to fix it though as I don't want to get into the html editor JS.

Show
Sam Marshall added a comment - This problem still occurs in current Moodle HEAD as well as in the initially quoted version (1.6.4). Probably it also affects all versions in between. I changed priority to 'major'; it's really somewhere between minor and major... yes, there's a workaround (go into source view and type in the link code manually) but it's not a workaround we can really expect users to carry out, and also this does result in minor dataloss in that the image you've inserted disappears and you have to insert it again. I don't think I'm volunteering to fix it though as I don't want to get into the html editor JS.
Hide
Dan Poltawski added a comment -

I've tried something which seems to get it to work in FF2, but not IE currently:

— htmlarea.php 2007-01-04 16:38:56.000000000 +0000
+++ htmlarea.php 2007-02-19 12:54:34.000000000 +0000
@@ -1479,7 +1481,15 @@
strLink = ' target="' param.f_target.trim() +'"';
}
strLink += '>';

  • strLink += (!HTMLArea.is_ie) ? sel : range.text;
    +
    + // UGLY HACK TO FIX 7043
    + var selectedEl = editor.getParentElement();
    + if(selectedEl.tagName.toLowerCase() == 'img') { + strLink+= selectedEl.parentNode.innerHTML; + }else{ + strLink += (!HTMLArea.is_ie) ? sel : range.text; + }
    +
    strLink += '</a>';
    editor.insertHTML(strLink);
    } else {
Show
Dan Poltawski added a comment - I've tried something which seems to get it to work in FF2, but not IE currently: — htmlarea.php 2007-01-04 16:38:56.000000000 +0000 +++ htmlarea.php 2007-02-19 12:54:34.000000000 +0000 @@ -1479,7 +1481,15 @@ strLink = ' target="' param.f_target.trim() +'"'; } strLink += '>';
  • strLink += (!HTMLArea.is_ie) ? sel : range.text; + + // UGLY HACK TO FIX 7043 + var selectedEl = editor.getParentElement(); + if(selectedEl.tagName.toLowerCase() == 'img') { + strLink+= selectedEl.parentNode.innerHTML; + }else{ + strLink += (!HTMLArea.is_ie) ? sel : range.text; + } + strLink += '</a>'; editor.insertHTML(strLink); } else {

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: