From 78f0e5e1540a831a2f55fe40d6c3d021333a60a9 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Mon, 6 May 2019 06:03:01 +0200 Subject: [PATCH 1/2] do not transform text of pasted links this skips links in markPasteRules (Bold, Italic, Code, Strike, Underline) fixes #258 works only if link extension is added before mark extensions extensions: [ ... new Link(), ... new Italic(), new Bold(), new Code(), new Strike(), new Underline(), ... ] --- packages/tiptap-commands/src/commands/markPasteRule.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/tiptap-commands/src/commands/markPasteRule.js b/packages/tiptap-commands/src/commands/markPasteRule.js index 009ae013..363f4d2c 100644 --- a/packages/tiptap-commands/src/commands/markPasteRule.js +++ b/packages/tiptap-commands/src/commands/markPasteRule.js @@ -8,12 +8,14 @@ export default function (regexp, type, getAttrs) { fragment.forEach(child => { if (child.isText) { - const { text } = child + const { text, marks } = child let pos = 0 let match + const isLink = !!marks.filter(x => x.type.name === 'link')[0] + // eslint-disable-next-line - while ((match = regexp.exec(text)) !== null) { + while (!isLink && (match = regexp.exec(text)) !== null) { if (match[1]) { const start = match.index const end = start + match[0].length From 6384bfde4e2a95ee5014ecce7cc4dd92d0026d53 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Tue, 7 May 2019 21:02:06 +0200 Subject: [PATCH 2/2] fix Link route in examples to not transform pasted links anymore --- examples/Components/Routes/Links/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Components/Routes/Links/index.vue b/examples/Components/Routes/Links/index.vue index 460524aa..59972bd3 100644 --- a/examples/Components/Routes/Links/index.vue +++ b/examples/Components/Routes/Links/index.vue @@ -72,10 +72,10 @@ export default { new OrderedList(), new TodoItem(), new TodoList(), + new Link(), new Bold(), new Code(), new Italic(), - new Link(), new History(), ], content: `