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(),
      ...
    ]
This commit is contained in:
Marius Tolzmann
2019-05-06 06:03:01 +02:00
parent 364c744cef
commit 78f0e5e154

View File

@@ -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