Permalink
Browse files

Re-enabling reading for link attributes whats been commented out.

(HTMLArea.prototype._createLink) These lines were commented out for
bug 1455 but it created another bug #2504.
  • Loading branch information...
julmis
julmis committed Feb 12, 2005
1 parent 193f298 commit 2fd414876382c70190f2132963c8379b2d3efa13
Showing with 20 additions and 8 deletions.
  1. +20 −8 lib/editor/htmlarea.php
View
@@ -1404,22 +1404,34 @@ function (str, l1, l2, l3) {
f_anchors:anchors };
}
this._popupDialog("link_std.php?id=<?php print(isset($id) && !empty($id)) ? $id : ''; ?>", function(param) {
- if (!param)
+ if (!param) {
return false;
+ }
var a = link;
if (!a) {
editor._doc.execCommand("createlink", false, param.f_href);
a = editor.getParentElement();
var sel = editor._getSelection();
var range = editor._createRange(sel);
- // if (!HTMLArea.is_ie) { /// Removed by PJ and Martin, Moodle bug #1455
- // a = range.startContainer;
- // if (!/^a$/i.test(a.tagName))
- // a = a.nextSibling;
- // }
- } else a.href = param.f_href.trim();
- if (!/^a$/i.test(a.tagName))
+ /// Removed by PJ and Martin, Moodle bug #1455
+ /// Removed uncommenting since it prevents this function
+ /// to read given attributes for <a> tag such as target, title etc...
+ if (!HTMLArea.is_ie) {
+ try {
+ a = range.startContainer;
+ if (!/^a$/i.test(a.tagName)) {
+ a = a.nextSibling;
+ }
+ } catch (e) {
+ alert("Send this message to bug tracker: " + e);
+ }
+ }
+ } else {
+ a.href = param.f_href.trim();
+ }
+ if (!/^a$/i.test(a.tagName)) {
return false;
+ }
a.target = param.f_target.trim();
a.title = param.f_title.trim();
editor.selectNodeContents(a);

0 comments on commit 2fd4148

Please sign in to comment.