From 24d32007d04a1c7b1374a08fd895c36906157686 Mon Sep 17 00:00:00 2001 From: julmis Date: Fri, 20 Aug 2004 10:28:16 +0000 Subject: [PATCH] Added text selection test, before opening insert link dialog. --- lib/editor/htmlarea.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/editor/htmlarea.php b/lib/editor/htmlarea.php index 0a02569cda..6199ca020b 100644 --- a/lib/editor/htmlarea.php +++ b/lib/editor/htmlarea.php @@ -1314,8 +1314,16 @@ HTMLArea.prototype._createLink = function(link) { 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 = { -- 2.39.5