Skip to content

Commit

Permalink
Fix: add class to elements exported from CodeNode (#5558)
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh authored Jan 29, 2024
1 parent 805ed3b commit b0cc9c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/lexical-code/src/CodeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
DOMConversionOutput,
DOMExportOutput,
EditorConfig,
LexicalEditor,
LexicalNode,
NodeKey,
ParagraphNode,
Expand Down Expand Up @@ -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) {
Expand Down

2 comments on commit b0cc9c4

@vercel
Copy link

@vercel vercel bot commented on b0cc9c4 Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

lexical-fbopensource.vercel.app
lexicaljs.org
lexical-git-main-fbopensource.vercel.app
lexical.dev
www.lexical.dev
lexicaljs.com

@vercel
Copy link

@vercel vercel bot commented on b0cc9c4 Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

lexical-playground-fbopensource.vercel.app
lexical-playground.vercel.app
playground.lexical.dev
lexical-playground-git-main-fbopensource.vercel.app

Please sign in to comment.