Skip to content

Commit

Permalink
fix(link): ensure text blocks exist before referencing them (#3251)
Browse files Browse the repository at this point in the history
Fixes #3250
  • Loading branch information
ScopeyNZ authored Sep 29, 2022
1 parent be4cde0 commit 539afce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/extension-link/src/helpers/autolink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export function autolink(options: AutolinkOptions): Plugin {
' ',
)
} else if (
nodesInChangedRanges.length
// We want to make sure to include the block seperator argument to treat hard breaks like spaces
newState.doc.textBetween(newRange.from, newRange.to, ' ', ' ').endsWith(' ')
&& newState.doc.textBetween(newRange.from, newRange.to, ' ', ' ').endsWith(' ')
) {
textBlock = nodesInChangedRanges[0]
textBeforeWhitespace = newState.doc.textBetween(
Expand Down

0 comments on commit 539afce

Please sign in to comment.