diff --git a/packages/extension-link/src/helpers/autolink.ts b/packages/extension-link/src/helpers/autolink.ts index 643a76f0a61..3e0dfaee547 100644 --- a/packages/extension-link/src/helpers/autolink.ts +++ b/packages/extension-link/src/helpers/autolink.ts @@ -63,10 +63,6 @@ export function autolink(options: AutolinkOptions): Plugin { } }) - if (!needsAutolink) { - return - } - // now let’s see if we can add new links const nodesInChangedRanges = findChildrenInRange( newState.doc, @@ -130,6 +126,10 @@ export function autolink(options: AutolinkOptions): Plugin { })) // add link mark .forEach(link => { + if (getMarksBetween(link.from, link.to, newState.doc).some(item => item.mark.type === options.type)) { + return + } + tr.addMark( link.from, link.to,