summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6adf9d2)
Replace <a href> and <img src> urls on save to fix common user mistake
breaking site deployment on a different [dev] domain.
});
// treat standalone placeholders as block elements
body = body.replace(/<p>(\[\[.*\]\])<\/p>/g, '$1');
});
// treat standalone placeholders as block elements
body = body.replace(/<p>(\[\[.*\]\])<\/p>/g, '$1');
+ // strip redundant domain in relative urls
+ var hostlink = 'https?://' + window.location.hostname.replace(/\W/g, '\\$&');
+ hostlink = new RegExp('(<a [^>]*href="|<img [^>]*src=")' + hostlink + '(?=/)', 'gi');
+ body = body.replace(hostlink, '$1');
var data = 'body='+encodeURIComponent(body);
var ajaxpost = new XMLHttpRequest();
var data = 'body='+encodeURIComponent(body);
var ajaxpost = new XMLHttpRequest();