Opened 14 years ago

Closed 14 years ago

#297 closed defect (fixed)

baseURL <-> baseHref

Reported by: niko Owned by: gogo
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version:
Severity: major Keywords:
Cc:

Description

there is currenlty the setting
baseURL AND baseHref

i think we can remove baseURL!

@@ -253,11 +256,6 @@
   // enable the 'Target' field in the Make Link dialog
   this.makeLinkShowsTarget = true;

-  // BaseURL included in the iframe document
-  this.baseURL = document.baseURI || document.URL;
-  if (this.baseURL && this.baseURL.match(/(.*)\/([^\/]+)/))
-    this.baseURL = RegExp.$1 + "/";
-
   // CharSet of the iframe, default is the charset of the document
   this.charSet = HTMLArea.is_gecko ? document.characterSet : document.charset;

@@ -3311,7 +3324,7 @@
       image = null;
   }
   if (image) outparam = {
-    f_base   : editor.config.baseURL,
+    f_base   : editor.config.baseHref,
     f_url    : HTMLArea.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"),
     f_alt    : image.alt,
     f_border : image.border,
@@ -4741,13 +4752,8 @@
 };

 HTMLArea.prototype.stripBaseURL = function(string) {
-  var baseurl = this.config.baseURL;
+  var baseurl = this.config.baseHref;

-  // strip to last directory in case baseurl points to a file
-  baseurl = baseurl.replace(/[^\/]+$/, '');
-  var basere = new RegExp(baseurl);
-  string = string.replace(basere, "");
-
   // strip host-part of URL which is added by MSIE to links relative to server root
   baseurl = baseurl.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1');
   basere = new RegExp(baseurl);

...to provide backwards-compatibility we might add this in editor.generate:

@@ -1216,6 +1214,21 @@
     }
   }

+
+  // no baseHref is set - or baseURL is set (backwards compatiblity)
+  if(editor.config.baseHref == null)
+  {
+    if(this.config.baseURL)
+        var baseURL  = this.config.baseURL;
+    else
+    {
+      var baseURL = document.baseURI || document.URL;
+      if (baseURL.match(/(.*)\/([^\/]+)/)) //strip filename
+        baseURL = RegExp.$1 + "/";
+    }
+    this.config.baseHref = baseURL;
+  }
+
   // create the editor framework, yah, table layout I know, but much easier
   // to get it working correctly this way, sorry about that, patches welcome.

but i don't think it will be needed.

please comment on this so i can checkin the patch.

Change History (1)

comment:1 Changed 14 years ago by niko

  • Resolution set to fixed
  • Status changed from new to closed

commited it (the first patch) in changeset:251
please report if this causes problems!

Note: See TracTickets for help on using tickets.