The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Handle NBSP in tiptap parsing (#8148)
Thomas Trompette2ba98ddaddcb
diff --git a/packages/twenty-front/src/modules/workflow/search-variables/utils/__tests__/parseEditorContent.test.ts b/packages/twenty-front/src/modules/workflow/search-variables/utils/__tests__/parseEditorContent.test.tsindex 1302ebb04a0..537530d23a1 100644--- a/packages/twenty-front/src/modules/workflow/search-variables/utils/__tests__/parseEditorContent.test.ts+++ b/packages/twenty-front/src/modules/workflow/search-variables/utils/__tests__/parseEditorContent.test.ts@@ -267,4 +267,33 @@ describe('parseEditorContent', () => {expect(parseEditorContent(input)).toBe('First line\nSecond line');});++ it('should handle spaces between variables correctly', () => {+ const input: JSONContent = {+ type: 'doc',+ content: [+ {+ type: 'paragraph',+ content: [+ {+ type: 'variableTag',+ attrs: { variable: '{{user.firstName}}' },+ },+ {+ type: 'text',+ text: '\u00A0', // NBSP character+ },+ {+ type: 'variableTag',+ attrs: { variable: '{{user.lastName}}' },+ },+ ],+ },+ ],+ };++ expect(parseEditorContent(input)).toBe(+ '{{user.firstName}} {{user.lastName}}',+ );+ });});diff --git a/packages/twenty-front/src/modules/workflow/search-variables/utils/parseEditorContent.ts b/packages/twenty-front/src/modules/workflow/search-variables/utils/parseEditorContent.tsindex ebad7f0e973..c27e655d002 100644--- a/packages/twenty-front/src/modules/workflow/search-variables/utils/parseEditorContent.ts+++ b/packages/twenty-front/src/modules/workflow/search-variables/utils/parseEditorContent.ts@@ -11,7 +11,8 @@ export const parseEditorContent = (json: JSONContent): string => {}if (node.type === 'text') {- return node.text || '';+ // Replace with regular space+ return node?.text?.replace(/\u00A0/g, ' ') ?? '';}if (node.type === 'hardBreak') {