Skip to content

Commit

Permalink
fix: mailto links from url drilldowns
Browse files Browse the repository at this point in the history
  • Loading branch information
ghudgins committed Nov 13, 2024
1 parent a5b266c commit 93c1844
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/plugins/field_formats/common/converters/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ describe('UrlFormat', () => {
);
});

test('outputs a mailto: link when URL starts with mailto:', () => {
const url = new UrlFormat({});

expect(url.convert('mailto:[email protected]', HTML_CONTEXT_TYPE)).toBe(
'<a href="mailto:[email protected]" target="_blank" rel="noopener noreferrer">mailto:[email protected]</a>'
);
});

test('outputs an <audio> if type === "audio"', () => {
const url = new UrlFormat({ type: 'audio' });

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/field_formats/common/converters/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '../types';

const templateMatchRE = /{{([\s\S]+?)}}/g;
const allowedUrlSchemes = ['http://', 'https://'];
const allowedUrlSchemes = ['http://', 'https://', 'mailto:'];

const URL_TYPES = [
{
Expand Down

0 comments on commit 93c1844

Please sign in to comment.