Permalink
Browse files

Another fix for creating links.

  • Loading branch information...
1 parent f8a5159 commit b5a5d9f668939c529bbf9e02e49d152366383e37 julmis committed Apr 14, 2006
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/editor/htmlarea/htmlarea.php
@@ -1470,15 +1470,26 @@ function (str, l1, l2, l3) {
a = range.startContainer;
if (!/^a$/i.test(a.tagName)) {
a = a.nextSibling;
+ if ( a == null ) {
+ a = range.startContainer.parentNode;
+ }
}
} catch (e) {
alert("Send this message to bug tracker: " + e);
}
}
} else {
- a.href = param.f_href.trim();
+ var href = param.f_href.trim();
+ editor.selectNodeContents(a);
+ if (href == "") {
+ editor._doc.execCommand("unlink", false, null);
+ editor.updateToolbar();
+ return false;
+ } else {
+ a.href = href;
+ }
}
- if (!/^a$/i.test(a.tagName)) {
+ if (!(a && /^a$/i.test(a.tagName))) {
return false;
}
a.target = param.f_target.trim();

0 comments on commit b5a5d9f

Please sign in to comment.