diff --git a/.changeset/nervous-spoons-remember.md b/.changeset/nervous-spoons-remember.md new file mode 100644 index 0000000..6d8fe79 --- /dev/null +++ b/.changeset/nervous-spoons-remember.md @@ -0,0 +1,5 @@ +--- +"penpot-exporter": patch +--- + +Fix fonts detection traversal on the whole document diff --git a/plugin-src/findAllTextnodes.ts b/plugin-src/findAllTextnodes.ts index 3856e22..564407b 100644 --- a/plugin-src/findAllTextnodes.ts +++ b/plugin-src/findAllTextnodes.ts @@ -1,6 +1,5 @@ import { isGoogleFont } from '@plugin/translators/text/font/gfonts'; import { isLocalFont } from '@plugin/translators/text/font/local'; -import { sleep } from '@plugin/utils'; import { registerChange } from './registerChange'; @@ -10,12 +9,10 @@ export const findAllTextNodes = async () => { for (const page of figma.root.children) { await page.loadAsync(); - for (const node of page.children) { - if (node.type === 'TEXT') { - extractMissingFonts(node, fonts); - } + const nodes = page.findAll(node => node.type === 'TEXT') as TextNode[]; - await sleep(0); + for (const node of nodes) { + extractMissingFonts(node, fonts); } }