diff --git a/packages/rich-text-links/src/index.ts b/packages/rich-text-links/src/index.ts index 38cbca6e..ece58e25 100644 --- a/packages/rich-text-links/src/index.ts +++ b/packages/rich-text-links/src/index.ts @@ -42,7 +42,7 @@ function addLinksFromRichTextNode(node: Node, links: EntityLinkMaps, type?: stri const toCrawl: Node[] = [node]; while (toCrawl.length > 0) { - const { data, content, nodeType } = toCrawl.pop() as Block; + const { data, content, nodeType } = toCrawl.shift() as Block; const hasRequestedNodeType = !type || nodeType === type; if (hasRequestedNodeType && isLinkObject(data)) {