mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Merge pull request #5013 from ErisDS/issue-4989-mailto
Accept mailto: links
This commit is contained in:
commit
40e98d27ef
3 changed files with 4 additions and 3 deletions
|
@ -20,7 +20,7 @@ var NavItemUrlInputComponent = Ember.TextField.extend({
|
|||
}),
|
||||
|
||||
isRelative: Ember.computed('value', function () {
|
||||
return !validator.isURL(this.get('value'));
|
||||
return !validator.isURL(this.get('value')) && this.get('value').indexOf('mailto:') !== 0;
|
||||
}),
|
||||
|
||||
didInsertElement: function () {
|
||||
|
@ -80,6 +80,7 @@ var NavItemUrlInputComponent = Ember.TextField.extend({
|
|||
var url = this.get('value'),
|
||||
baseUrl = this.get('baseUrl');
|
||||
|
||||
// if we have a relative url, create the absolute url to be displayed in the input
|
||||
if (this.get('isRelative')) {
|
||||
this.set('value', joinUrlParts(baseUrl, url));
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ NavigationController = Ember.Controller.extend({
|
|||
if (url[url.length - 1] !== '/') {
|
||||
url += '/';
|
||||
}
|
||||
} else if (!validator.isURL(url) && url !== '' && url[0] !== '/') {
|
||||
} else if (!validator.isURL(url) && url !== '' && url[0] !== '/' && url.indexOf('mailto:') !== 0) {
|
||||
url = '/' + url;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ function urlFor(context, data, absolute) {
|
|||
}
|
||||
|
||||
// This url already has a protocol so is likely an external url to be returned
|
||||
if (urlPath && urlPath.indexOf('://') !== -1) {
|
||||
if (urlPath && (urlPath.indexOf('://') !== -1 || urlPath.indexOf('mailto:') === 0)) {
|
||||
return urlPath;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue