From 6fc812a08fb73cc97d43b1e2ab6b99ad311d5443 Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Thu, 13 Jun 2024 10:06:44 +0200 Subject: [PATCH] Avoid adding indentation for texts with no indent (#156) * Avoid adding indentation for texts with no indent * fix previous changelog --- .changeset/lucky-bottles-sparkle.md | 2 +- .changeset/proud-foxes-jump.md | 5 +++++ plugin-src/translators/text/paragraph/Paragraph.ts | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .changeset/proud-foxes-jump.md diff --git a/.changeset/lucky-bottles-sparkle.md b/.changeset/lucky-bottles-sparkle.md index fe69ed3..faf38c7 100644 --- a/.changeset/lucky-bottles-sparkle.md +++ b/.changeset/lucky-bottles-sparkle.md @@ -1,5 +1,5 @@ --- -"penpot-exporter": minor +"penpot-exporter": patch --- Translate line endings done with shift+Enter in Figma diff --git a/.changeset/proud-foxes-jump.md b/.changeset/proud-foxes-jump.md new file mode 100644 index 0000000..a649905 --- /dev/null +++ b/.changeset/proud-foxes-jump.md @@ -0,0 +1,5 @@ +--- +"penpot-exporter": patch +--- + +Do not apply indentation to texts with indent zero diff --git a/plugin-src/translators/text/paragraph/Paragraph.ts b/plugin-src/translators/text/paragraph/Paragraph.ts index ffe2419..fc7b71c 100644 --- a/plugin-src/translators/text/paragraph/Paragraph.ts +++ b/plugin-src/translators/text/paragraph/Paragraph.ts @@ -63,7 +63,9 @@ export class Paragraph { return false; } - private segmentIndent(indent: number): PenpotTextNode { + private segmentIndent(indent: number): PenpotTextNode | undefined { + if (indent === 0) return; + return { text: ' '.repeat(indent), fontId: 'sourcesanspro',