0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00

Fix empty text layers (#120)

* Fix empty texts

* add changelog
This commit is contained in:
Jordi Sala Morales 2024-05-27 18:13:19 +02:00 committed by GitHub
parent 35d9d47e2a
commit 044b09207b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 10 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---
Fix text layers without text content

View file

@ -22,19 +22,21 @@ export const transformText = async (node: TextNode): Promise<Partial<TextShape>>
content: { content: {
type: 'root', type: 'root',
verticalAlign: translateVerticalAlign(node.textAlignVertical), verticalAlign: translateVerticalAlign(node.textAlignVertical),
children: [ children: styledTextSegments.length
? [
{ {
type: 'paragraph-set', type: 'paragraph-set',
children: [ children: [
{ {
type: 'paragraph', type: 'paragraph',
children: await translateStyleTextSegments(node, styledTextSegments), children: await translateStyleTextSegments(node, styledTextSegments),
...(styledTextSegments.length ? transformTextStyle(node, styledTextSegments[0]) : {}), ...transformTextStyle(node, styledTextSegments[0]),
...(await transformFills(node)) ...(await transformFills(node))
} }
] ]
} }
] ]
: undefined
}, },
growType: translateGrowType(node) growType: translateGrowType(node)
}; };