Skip to content

Commit

Permalink
docs(serialization): add node helpers to ExtendedTextNode example (fa…
Browse files Browse the repository at this point in the history
  • Loading branch information
CanRau authored and amanharwara committed Jan 18, 2024
1 parent e974708 commit 55d3ed1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/lexical-website/docs/concepts/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ import {
DOMConversionOutput,
NodeKey,
TextNode,
SerializedTextNode
SerializedTextNode,
LexicalNode
} from 'lexical';

export class ExtendedTextNode extends TextNode {
Expand Down Expand Up @@ -373,6 +374,14 @@ export class ExtendedTextNode extends TextNode {
}
}

export function $createExtendedTextNode(text: string): ExtendedTextNode {
return new ExtendedTextNode(text, className);
}

export function $isExtendedTextNode(node: LexicalNode | null | undefined): node is ExtendedTextNode {
return node instanceof ExtendedTextNode;
}

function patchStyleConversion(
originalDOMConverter?: (node: HTMLElement) => DOMConversion | null
): (node: HTMLElement) => DOMConversionOutput | null {
Expand Down

0 comments on commit 55d3ed1

Please sign in to comment.