From 5e44781be1b9e4124b754d22b897e8c6abac613e Mon Sep 17 00:00:00 2001 From: Etienne <45695613+etiennejouan@users.noreply.github.com> Date: Wed, 10 Dec 2025 15:08:08 +0100 Subject: [PATCH] Fix line break in richTextV2 field workflow editor (#16462) Api expect markdown format where '\n' is escape (but not ' \n') fixes https://github.com/twentyhq/twenty/issues/14976 --- .../components/__stories__/FormRichTextV2FieldInput.stories.tsx | 2 +- .../utils/__tests__/parseEditorContent.test.ts | 2 +- .../workflow/workflow-variables/utils/parseEditorContent.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRichTextV2FieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRichTextV2FieldInput.stories.tsx index 65a0e701af..1dce5e37ff 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRichTextV2FieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormRichTextV2FieldInput.stories.tsx @@ -90,7 +90,7 @@ export const WithVariable: Story = { await waitFor(() => { expect(args.onChange).toHaveBeenCalledWith({ blocknote: null, - markdown: `## Title\nVariable: {{${MOCKED_STEP_ID}.name}}`, + markdown: `## Title \nVariable: {{${MOCKED_STEP_ID}.name}}`, }); }); expect(args.onChange).toHaveBeenCalledTimes(1); diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/__tests__/parseEditorContent.test.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/__tests__/parseEditorContent.test.ts index c5f4f07516..eb91b4b0f3 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/__tests__/parseEditorContent.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/__tests__/parseEditorContent.test.ts @@ -265,7 +265,7 @@ describe('parseEditorContent', () => { ], }; - expect(parseEditorContent(input)).toBe('First line\nSecond line'); + expect(parseEditorContent(input)).toBe('First line \nSecond line'); }); it('should handle spaces between variables correctly', () => { diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/parseEditorContent.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/parseEditorContent.ts index 7c28a40791..05884fa397 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/parseEditorContent.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/parseEditorContent.ts @@ -16,7 +16,7 @@ export const parseEditorContent = (json: JSONContent): string => { } if (node.type === 'hardBreak') { - return '\n'; + return ' \n'; } if (node.type === 'variableTag') {