Skip to content

Commit

Permalink
Update packages/lexical-website/docs/concepts/node-replacement.md
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum authored Nov 30, 2024
1 parent 34c7f64 commit b3dd83d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/lexical-website/docs/concepts/node-replacement.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const editorConfig = {
In the snippet above,
- `replace`: Specifies the core node type to be replaced.
- `with`: Defines a transformation function to replace instances of the original node to the custom node.
- `withKlass`: This option ensures that behaviors associated with the original node type work seamlessly with the replacement. For instance, node transforms or listeners targeting ParagraphNode will also apply to CustomParagraphNode when withKlass is specified. Without this option, the custom node might not fully integrate with the editor's built-in features, leading to unexpected behavior.
- `withKlass`: This option ensures that behaviors associated with the original node type work seamlessly with the replacement. For instance, node transforms or mutation listeners targeting ParagraphNode will also apply to CustomParagraphNode when withKlass is specified. Without this option, the custom node might not fully integrate with the editor's built-in features, leading to unexpected behavior.

Once this is done, Lexical will replace all ParagraphNode instances with CustomParagraphNode instances. One important use case for this feature is overriding the serialization behavior of core nodes. Check out the full example below.

Expand Down

0 comments on commit b3dd83d

Please sign in to comment.