diff --git a/.changeset/gorgeous-rings-compete.md b/.changeset/gorgeous-rings-compete.md new file mode 100644 index 0000000..6392f94 --- /dev/null +++ b/.changeset/gorgeous-rings-compete.md @@ -0,0 +1,5 @@ +--- +"penpot-exporter": patch +--- + +Fix text layers without text content diff --git a/plugin-src/transformers/partials/transformText.ts b/plugin-src/transformers/partials/transformText.ts index ef00123..5d00a55 100644 --- a/plugin-src/transformers/partials/transformText.ts +++ b/plugin-src/transformers/partials/transformText.ts @@ -22,19 +22,21 @@ export const transformText = async (node: TextNode): Promise> content: { type: 'root', verticalAlign: translateVerticalAlign(node.textAlignVertical), - children: [ - { - type: 'paragraph-set', - children: [ + children: styledTextSegments.length + ? [ { - type: 'paragraph', - children: await translateStyleTextSegments(node, styledTextSegments), - ...(styledTextSegments.length ? transformTextStyle(node, styledTextSegments[0]) : {}), - ...(await transformFills(node)) + type: 'paragraph-set', + children: [ + { + type: 'paragraph', + children: await translateStyleTextSegments(node, styledTextSegments), + ...transformTextStyle(node, styledTextSegments[0]), + ...(await transformFills(node)) + } + ] } ] - } - ] + : undefined }, growType: translateGrowType(node) };