parent
160eca4795
commit
51d85e58eb
2 changed files with 282 additions and 6 deletions
|
@ -66,9 +66,10 @@ story.add('Blocked Protocols', () => {
|
||||||
return <Linkify {...props} />;
|
return <Linkify {...props} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
story.add('Missing Protocol', () => {
|
story.add('Missing protocols', () => {
|
||||||
const props = createProps({
|
const props = createProps({
|
||||||
text: 'github.com is a place for things',
|
text:
|
||||||
|
"I love example.com. I also love кц.рф. I also love مثال.تونس. But I do not love test.example.",
|
||||||
});
|
});
|
||||||
|
|
||||||
return <Linkify {...props} />;
|
return <Linkify {...props} />;
|
||||||
|
|
|
@ -11,31 +11,306 @@ import { splitByEmoji } from '../../util/emoji';
|
||||||
import { missingCaseError } from '../../util/missingCaseError';
|
import { missingCaseError } from '../../util/missingCaseError';
|
||||||
|
|
||||||
const linkify = LinkifyIt()
|
const linkify = LinkifyIt()
|
||||||
// This is all of the TLDs in place in 2010, according to [Wikipedia][0]. Note that
|
// This is all TLDs in place in 2010, according to [IANA's root zone database][0]
|
||||||
// this only applies to "fuzzy" matches (`example.com`), not matches with
|
// except for those domains marked as [a test domain][1].
|
||||||
// protocols (`https://example.com`).
|
//
|
||||||
// [0]: https://en.wikipedia.org/wiki/Generic_top-level_domain#History
|
// Note that this only applies to "fuzzy" matches (`example.com`), not matches with
|
||||||
|
// protocols (`https://example.com`). See [this GitHub comment][2] for more.
|
||||||
|
//
|
||||||
|
// [0]: https://www.iana.org/domains/root/db
|
||||||
|
// [1]: https://www.iana.org/domains/reserved
|
||||||
|
// [2]: https://github.com/signalapp/Signal-Desktop/issues/4538#issuecomment-748368590
|
||||||
.tlds([
|
.tlds([
|
||||||
|
'ac',
|
||||||
|
'ad',
|
||||||
|
'ae',
|
||||||
'aero',
|
'aero',
|
||||||
|
'af',
|
||||||
|
'ag',
|
||||||
|
'ai',
|
||||||
|
'al',
|
||||||
|
'am',
|
||||||
|
'an',
|
||||||
|
'ao',
|
||||||
|
'aq',
|
||||||
|
'ar',
|
||||||
|
'arpa',
|
||||||
|
'as',
|
||||||
'asia',
|
'asia',
|
||||||
|
'at',
|
||||||
|
'au',
|
||||||
|
'aw',
|
||||||
|
'ax',
|
||||||
|
'az',
|
||||||
|
'ba',
|
||||||
|
'bb',
|
||||||
|
'bd',
|
||||||
|
'be',
|
||||||
|
'bf',
|
||||||
|
'bg',
|
||||||
|
'bh',
|
||||||
|
'bi',
|
||||||
'biz',
|
'biz',
|
||||||
|
'bj',
|
||||||
|
'bl',
|
||||||
|
'bm',
|
||||||
|
'bn',
|
||||||
|
'bo',
|
||||||
|
'bq',
|
||||||
|
'br',
|
||||||
|
'bs',
|
||||||
|
'bt',
|
||||||
|
'bv',
|
||||||
|
'bw',
|
||||||
|
'by',
|
||||||
|
'bz',
|
||||||
|
'ca',
|
||||||
'cat',
|
'cat',
|
||||||
|
'cc',
|
||||||
|
'cd',
|
||||||
|
'cf',
|
||||||
|
'cg',
|
||||||
|
'ch',
|
||||||
|
'ci',
|
||||||
|
'ck',
|
||||||
|
'cl',
|
||||||
|
'cm',
|
||||||
|
'cn',
|
||||||
|
'co',
|
||||||
'com',
|
'com',
|
||||||
'coop',
|
'coop',
|
||||||
|
'cr',
|
||||||
|
'cu',
|
||||||
|
'cv',
|
||||||
|
'cw',
|
||||||
|
'cx',
|
||||||
|
'cy',
|
||||||
|
'cz',
|
||||||
|
'de',
|
||||||
|
'dj',
|
||||||
|
'dk',
|
||||||
|
'dm',
|
||||||
|
'do',
|
||||||
|
'dz',
|
||||||
|
'ec',
|
||||||
'edu',
|
'edu',
|
||||||
|
'ee',
|
||||||
|
'eg',
|
||||||
|
'er',
|
||||||
|
'es',
|
||||||
|
'et',
|
||||||
|
'eu',
|
||||||
|
'fi',
|
||||||
|
'fj',
|
||||||
|
'fk',
|
||||||
|
'fm',
|
||||||
|
'fo',
|
||||||
|
'fr',
|
||||||
|
'ga',
|
||||||
|
'gb',
|
||||||
|
'gd',
|
||||||
|
'ge',
|
||||||
|
'gf',
|
||||||
|
'gg',
|
||||||
|
'gh',
|
||||||
|
'gi',
|
||||||
|
'gl',
|
||||||
|
'gm',
|
||||||
|
'gn',
|
||||||
'gov',
|
'gov',
|
||||||
|
'gp',
|
||||||
|
'gq',
|
||||||
|
'gr',
|
||||||
|
'gs',
|
||||||
|
'gt',
|
||||||
|
'gu',
|
||||||
|
'gw',
|
||||||
|
'gy',
|
||||||
|
'hk',
|
||||||
|
'hm',
|
||||||
|
'hn',
|
||||||
|
'hr',
|
||||||
|
'ht',
|
||||||
|
'hu',
|
||||||
|
'id',
|
||||||
|
'ie',
|
||||||
|
'il',
|
||||||
|
'im',
|
||||||
|
'in',
|
||||||
'info',
|
'info',
|
||||||
'int',
|
'int',
|
||||||
|
'io',
|
||||||
|
'iq',
|
||||||
|
'ir',
|
||||||
|
'is',
|
||||||
|
'it',
|
||||||
|
'je',
|
||||||
|
'jm',
|
||||||
|
'jo',
|
||||||
'jobs',
|
'jobs',
|
||||||
|
'jp',
|
||||||
|
'ke',
|
||||||
|
'kg',
|
||||||
|
'kh',
|
||||||
|
'ki',
|
||||||
|
'km',
|
||||||
|
'kn',
|
||||||
|
'kp',
|
||||||
|
'kr',
|
||||||
|
'kw',
|
||||||
|
'ky',
|
||||||
|
'kz',
|
||||||
|
'la',
|
||||||
|
'lb',
|
||||||
|
'lc',
|
||||||
|
'li',
|
||||||
|
'lk',
|
||||||
|
'lr',
|
||||||
|
'ls',
|
||||||
|
'lt',
|
||||||
|
'lu',
|
||||||
|
'lv',
|
||||||
|
'ly',
|
||||||
|
'ma',
|
||||||
|
'mc',
|
||||||
|
'md',
|
||||||
|
'me',
|
||||||
|
'mf',
|
||||||
|
'mg',
|
||||||
|
'mh',
|
||||||
'mil',
|
'mil',
|
||||||
|
'mk',
|
||||||
|
'ml',
|
||||||
|
'mm',
|
||||||
|
'mn',
|
||||||
|
'mo',
|
||||||
'mobi',
|
'mobi',
|
||||||
|
'mp',
|
||||||
|
'mq',
|
||||||
|
'mr',
|
||||||
|
'ms',
|
||||||
|
'mt',
|
||||||
|
'mu',
|
||||||
'museum',
|
'museum',
|
||||||
|
'mv',
|
||||||
|
'mw',
|
||||||
|
'mx',
|
||||||
|
'my',
|
||||||
|
'mz',
|
||||||
|
'na',
|
||||||
'name',
|
'name',
|
||||||
|
'nc',
|
||||||
|
'ne',
|
||||||
'net',
|
'net',
|
||||||
|
'nf',
|
||||||
|
'ng',
|
||||||
|
'ni',
|
||||||
|
'nl',
|
||||||
|
'no',
|
||||||
|
'np',
|
||||||
|
'nr',
|
||||||
|
'nu',
|
||||||
|
'nz',
|
||||||
|
'om',
|
||||||
'org',
|
'org',
|
||||||
|
'pa',
|
||||||
|
'pe',
|
||||||
|
'pf',
|
||||||
|
'pg',
|
||||||
|
'ph',
|
||||||
|
'pk',
|
||||||
|
'pl',
|
||||||
|
'pm',
|
||||||
|
'pn',
|
||||||
|
'pr',
|
||||||
'pro',
|
'pro',
|
||||||
|
'ps',
|
||||||
|
'pt',
|
||||||
|
'pw',
|
||||||
|
'py',
|
||||||
|
'qa',
|
||||||
|
're',
|
||||||
|
'ro',
|
||||||
|
'rs',
|
||||||
|
'ru',
|
||||||
|
'rw',
|
||||||
|
'sa',
|
||||||
|
'sb',
|
||||||
|
'sc',
|
||||||
|
'sd',
|
||||||
|
'se',
|
||||||
|
'sg',
|
||||||
|
'sh',
|
||||||
|
'si',
|
||||||
|
'sj',
|
||||||
|
'sk',
|
||||||
|
'sl',
|
||||||
|
'sm',
|
||||||
|
'sn',
|
||||||
|
'so',
|
||||||
|
'sr',
|
||||||
|
'st',
|
||||||
|
'su',
|
||||||
|
'sv',
|
||||||
|
'sx',
|
||||||
|
'sy',
|
||||||
|
'sz',
|
||||||
|
'tc',
|
||||||
|
'td',
|
||||||
'tel',
|
'tel',
|
||||||
|
'tf',
|
||||||
|
'tg',
|
||||||
|
'th',
|
||||||
|
'tj',
|
||||||
|
'tk',
|
||||||
|
'tl',
|
||||||
|
'tm',
|
||||||
|
'tn',
|
||||||
|
'to',
|
||||||
|
'tp',
|
||||||
|
'tr',
|
||||||
'travel',
|
'travel',
|
||||||
|
'tt',
|
||||||
|
'tv',
|
||||||
|
'tw',
|
||||||
|
'tz',
|
||||||
|
'ua',
|
||||||
|
'ug',
|
||||||
|
'uk',
|
||||||
|
'um',
|
||||||
|
'us',
|
||||||
|
'uy',
|
||||||
|
'uz',
|
||||||
|
'va',
|
||||||
|
'vc',
|
||||||
|
've',
|
||||||
|
'vg',
|
||||||
|
'vi',
|
||||||
|
'vn',
|
||||||
|
'vu',
|
||||||
|
'wf',
|
||||||
|
'ws',
|
||||||
|
'中国',
|
||||||
|
'中國',
|
||||||
|
'ලංකා',
|
||||||
|
'香港',
|
||||||
|
'台湾',
|
||||||
|
'台灣',
|
||||||
|
'امارات',
|
||||||
|
'الاردن',
|
||||||
|
'السعودية',
|
||||||
|
'ไทย',
|
||||||
|
'рф',
|
||||||
|
'تونس',
|
||||||
|
'مصر',
|
||||||
|
'قطر',
|
||||||
|
'இலங்கை',
|
||||||
|
'فلسطين',
|
||||||
|
'ye',
|
||||||
|
'yt',
|
||||||
|
'za',
|
||||||
|
'zm',
|
||||||
|
'zw',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue