Skip to content
Browse files

Added text selection test, before opening insert link dialog.

  • Loading branch information...
1 parent 3c719e4 commit 24d32007d04a1c7b1374a08fd895c36906157686 julmis committed Aug 20, 2004
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/editor/htmlarea.php
View
10 lib/editor/htmlarea.php
@@ -1314,8 +1314,16 @@ function (str, l1, l2, l3) {
var outparam = null;
if (typeof link == "undefined") {
link = this.getParentElement();
- if (link && !/^a$/i.test(link.tagName))
+ if (link && !/^a$/i.test(link.tagName)) {
link = null;
+ var sel = this._getSelection();
+ var rng = this._createRange(sel);
+ var len = HTMLArea.is_ie ? rng.text.toString().length : sel.toString().length;
+ if(len < 1) {
+ alert("You must select text first!");
+ return false;
+ }
+ }
}
if (link) {
outparam = {

0 comments on commit 24d3200

Please sign in to comment.
Something went wrong with that request. Please try again.