You are not logged in.
Pages: 1
I have pages that are published on one domain (lets say http://foo.com) and are edited on another domain (lets say http://edit.foo.com). The pages have links to images "/images/logo.jpg".
If they were simply relative links (e.g., "../images/logo.jpg"), I could use config.baseHref to handle them. But because they are absolute -- but don't include the domain -- baseHref doesn't have any effect on them. Is there anyway I can give a "base domain" or something like that?
I see baseHref actually creates the BASE HREF tag, and I'm not sure if there event exists any tag that does what I want... but I'm hoping you guys have an idea.
Offline
Same problem here.
Hopefully you guys can come up with a solution for this.
Thanx in advance
Offline
There are different behaviours of the base tag on different browsers. And there are certainly some outstanding bugs in Mozilla/Firefox when it comes to text editing. Which are you using?
I have written (as I threatened in http://xinha.gogo.co.nz/punbb/viewtopic.php?id=325) a replacement for fixRelativeLinks which allows you to choose 'absolute', 'domain' (what you want) and 'relative'. It will adjust all links it can according to your preference using the baseHref as the target.
There are still some issues with it, most of which relate to browser problems. Let me know if it would be of use.
Steve
Offline
OK I found your problem.
The offending code is in 'inwardHtml' and 'outwardHtml' where it says:
// For IE's sake, make any URLs that are semi-absolute (="/....") to be
// truely absolute
and
// Make semi-absolute links to be truely absolute
// we do this just to standardize so that special replacements knows what
// to expect
it then goes on to use the current page domain (NOT THE BASE) to fix it. So your image location gets well and truly broken on load and on save.
A quick fix would be to cut the offending lines. Everything seems to work just as well, but I may be missing the point! To do so without modifying the delivered code, insert the following just before your Xinha start-up code:
HTMLArea.prototype.inwardHtml = function(html)
{
// Midas uses b and i instead of strong and em, um, hello,
// mozilla, this is the 21st century calling!
if (HTMLArea.is_gecko) {
html = html.replace(/<(\/?)strong(\s|>|\/)/ig, "<$1b$2");
html = html.replace(/<(\/?)em(\s|>|\/)/ig, "<$1i$2");
}
// replace window.open to that any clicks won't open a popup in designMode
html = html.replace("onclick=\"window.open(", "onclick=\"try{if(document.designMode && document.designMode == 'on') return false;}catch(e){} window.open(");
html = this.inwardSpecialReplacements(html);
// For IE's sake, make any URLs that are semi-absolute (="/....") to be
// truely absolute
//var nullRE = new RegExp('((href|src|background)=[\'"])/+', 'gi');
//html = html.replace(nullRE, '$1' + location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1') + '/');
html = this.fixRelativeLinks(html);
return html;
}
HTMLArea.prototype.outwardHtml = function(html)
{
html = html.replace(/<(\/?)b(\s|>|\/)/ig, "<$1strong$2");
html = html.replace(/<(\/?)i(\s|>|\/)/ig, "<$1em$2");
// replace window.open to that any clicks won't open a popup in designMode
html = html.replace("onclick=\"try{if(document.designMode && document.designMode == 'on') return false;}catch(e){} window.open(", "onclick=\"window.open(");
// Figure out what our server name is, and how it's referenced
var serverBase = location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1') + '/';
// IE puts this in can't figure out why
html = html.replace(/https?:\/\/null\//g, serverBase);
// Make semi-absolute links to be truely absolute
// we do this just to standardize so that special replacements knows what
// to expect
//html = html.replace(/((href|src|background)=[\'\"])\/+/ig, '$1' + serverBase);
html = this.outwardSpecialReplacements(html);
html = this.fixRelativeLinks(html);
if(this.config.sevenBitClean)
{
html = html.replace(/[^ -~\r\n\t]/g, function(c){ return '&#'+c.charCodeAt(0)+';';});
}
// ticket:56, the "greesemonkey" plugin for Firefox adds this junk,
// so we strip it out. Original submitter gave a plugin, but that's
// a bit much just for this IMHO - james
if(HTMLArea.is_gecko)
{
html = html.replace(/<script[\s]*src[\s]*=[\s]*['"]chrome:\/\/.*?["']>[\s]*<\/script>/ig, '');
}
return html;
}
xinha_editors = null; ... etc
Let me know how you get on. If anyone can explain what that code was intended to do I would be keen to learn.
Steve
Offline
Pages: 1