From b0cc9c45794f4634e910da0224ecc580a70f59fe Mon Sep 17 00:00:00 2001 From: wnhlee <40269597+2wheeh@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:32:23 +0900 Subject: [PATCH] Fix: add class to elements exported from CodeNode (#5558) --- packages/lexical-code/src/CodeNode.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/lexical-code/src/CodeNode.ts b/packages/lexical-code/src/CodeNode.ts index 7b2281b01b2..2ad364f905e 100644 --- a/packages/lexical-code/src/CodeNode.ts +++ b/packages/lexical-code/src/CodeNode.ts @@ -12,6 +12,7 @@ import type { DOMConversionOutput, DOMExportOutput, EditorConfig, + LexicalEditor, LexicalNode, NodeKey, ParagraphNode, @@ -129,8 +130,9 @@ export class CodeNode extends ElementNode { return false; } - exportDOM(): DOMExportOutput { + exportDOM(editor: LexicalEditor): DOMExportOutput { const element = document.createElement('pre'); + addClassNamesToElement(element, editor._config.theme.code); element.setAttribute('spellcheck', 'false'); const language = this.getLanguage(); if (language) {