mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-03 05:10:13 -05:00
Find missing fonts in all the document (#170)
* Find missing fonts in all the document * add changelog
This commit is contained in:
parent
5f884985b9
commit
ebad146d7f
2 changed files with 8 additions and 6 deletions
5
.changeset/nervous-spoons-remember.md
Normal file
5
.changeset/nervous-spoons-remember.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"penpot-exporter": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix fonts detection traversal on the whole document
|
|
@ -1,6 +1,5 @@
|
||||||
import { isGoogleFont } from '@plugin/translators/text/font/gfonts';
|
import { isGoogleFont } from '@plugin/translators/text/font/gfonts';
|
||||||
import { isLocalFont } from '@plugin/translators/text/font/local';
|
import { isLocalFont } from '@plugin/translators/text/font/local';
|
||||||
import { sleep } from '@plugin/utils';
|
|
||||||
|
|
||||||
import { registerChange } from './registerChange';
|
import { registerChange } from './registerChange';
|
||||||
|
|
||||||
|
@ -10,12 +9,10 @@ export const findAllTextNodes = async () => {
|
||||||
for (const page of figma.root.children) {
|
for (const page of figma.root.children) {
|
||||||
await page.loadAsync();
|
await page.loadAsync();
|
||||||
|
|
||||||
for (const node of page.children) {
|
const nodes = page.findAll(node => node.type === 'TEXT') as TextNode[];
|
||||||
if (node.type === 'TEXT') {
|
|
||||||
extractMissingFonts(node, fonts);
|
|
||||||
}
|
|
||||||
|
|
||||||
await sleep(0);
|
for (const node of nodes) {
|
||||||
|
extractMissingFonts(node, fonts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue