Skip to content

Commit

Permalink
fix(link): fix links autolinking when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbch committed Apr 27, 2023
1 parent ee86f86 commit 25ae4ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/extension-link/src/helpers/autolink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 25ae4ee

Please sign in to comment.