From 0f14574b85022f8058594f5f58f4ff837dd8ca7f Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Thu, 1 Jul 2004 12:00:46 +0000 Subject: [PATCH] fixed bug 1550 about broken anchor links --- lib/editor/htmlarea.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/editor/htmlarea.php b/lib/editor/htmlarea.php index e5f8bc1ba6..386f136434 100644 --- a/lib/editor/htmlarea.php +++ b/lib/editor/htmlarea.php @@ -2169,17 +2169,17 @@ HTMLArea.getHTML = function(root, outputRoot, editor) { }; HTMLArea.prototype.stripBaseURL = function(string) { + var baseurl = this.config.baseURL; // IE adds the path to an anchor, converting #anchor // to path/#anchor which of course needs to be fixed var index = string.indexOf("/#")+1; - if (index > 0) { + if ((index > 0) && (string.indexOf(baseurl) > -1)) { return string.substr(index); } return string; // Moodle doesn't use the code below because // Moodle likes to keep absolute links - - var baseurl = this.config.baseURL; + // strip to last directory in case baseurl points to a file baseurl = baseurl.replace(/[^\/]+$/, ''); var basere = new RegExp(baseurl); -- 2.39.5