I am building an email client which uses lexical to convert the Rich Text into HTML using $generateHtmlFromNodes
. I have specified the Tailwindcss class names in the lexical theme property of the initialConfig
.
const theme: EditorThemeClasses = {
paragraph: 'text-base mb-1',
center: 'text-center text-blue-200',
list: {
nested: {
listitem: 'list-disc',
},
ol: 'list-decimal',
ul: 'list-disc',
listitem: 'list-inside',
},
text: {
bold: 'font-bold',
italic: 'italic',
underline: 'underline',
strikethrough: 'line-through',
underlineStrikethrough: 'line-through underline',
},
link: 'text-blue-500 hover:text-blue-600',
image: 'object-contain flex flex-row w-2/3 p-4 h-auto',
};
const initialConfig = {
namespace: 'MyEditor',
editable: true,
nodes: [ImageNode, ListNode, ListItemNode],
theme,
onError(error) {
throw error;
},
};
I am able to get fully renderable html with the correct class names, however when the email is sent, the CDN tag is either stripped from the email or does not convert the styles correctly.
Is there a way to prefer inline css over class names in either the Lexical initialConfig
or when using $generateHtmlFromNodes
?