From b7c165946218baeba4989170c7b89919cb489c0f Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 7 Aug 2020 14:41:44 +0200 Subject: [PATCH 1/2] improve pasteRule for links, allow single letter domains --- packages/tiptap-extensions/src/marks/Link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tiptap-extensions/src/marks/Link.js b/packages/tiptap-extensions/src/marks/Link.js index e1497ea61..774705e08 100644 --- a/packages/tiptap-extensions/src/marks/Link.js +++ b/packages/tiptap-extensions/src/marks/Link.js @@ -56,7 +56,7 @@ export default class Link extends Mark { pasteRules({ type }) { return [ pasteRule( - /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-zA-Z]{2,}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g, + /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g, type, url => ({ href: url }), ), From 852d9e680d51d08e9bd6f777206db136223285aa Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 7 Aug 2020 14:42:22 +0200 Subject: [PATCH 2/2] improve pasteRule for links, allow uppercase domains --- packages/tiptap-extensions/src/marks/Link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tiptap-extensions/src/marks/Link.js b/packages/tiptap-extensions/src/marks/Link.js index 774705e08..4e8f1cf0c 100644 --- a/packages/tiptap-extensions/src/marks/Link.js +++ b/packages/tiptap-extensions/src/marks/Link.js @@ -56,7 +56,7 @@ export default class Link extends Mark { pasteRules({ type }) { return [ pasteRule( - /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g, + /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/gi, type, url => ({ href: url }), ),