feat: rich text email body (#14482)

Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Arik Chakma
2025-09-21 20:55:34 +06:00
committed by GitHub
parent a89e5d0f27
commit 9a2766feae
66 changed files with 3312 additions and 276 deletions
@@ -109,6 +109,7 @@ export const WorkflowVariablesDropdown = ({
return (
<Dropdown
dropdownId={dropdownId}
isDropdownInModal={true}
clickableComponent={
clickableComponent ?? (
<StyledDropdownVariableButtonContainer
@@ -0,0 +1,31 @@
import { getInitialEditorContent } from '@/workflow/workflow-variables/utils/getInitialEditorContent';
import type { JSONContent } from '@tiptap/react';
import { logError } from '~/utils/logError';
// Previous format of the email body was plain text,
// but from now on we will save it as JSON.
// So it will fail to parse the content, that's why we have this fallback.
export const getInitialEmailEditorContent = (
rawContent: string,
): JSONContent => {
// Handle empty or null content
if (!rawContent || rawContent.trim() === '') {
return {
type: 'doc',
content: [
{
type: 'paragraph',
content: [],
},
],
};
}
try {
const json = JSON.parse(rawContent);
return json;
} catch (error) {
logError(error);
return getInitialEditorContent(rawContent);
}
};