Open
Description
Description
When using node replacement, it's often useful to specify the withKlass
option so that any behaviors that were intended for the original node type should work with the replaced node type (e.g. node transforms, mutation listeners, etc.).
- Concept documentation completed in [lexical-website] Feature: Document the withKlass option for node replacement #6890
- API documentation is still missing
Impact
Anyone replacing built-in nodes with extended versions should probably be using this, but they wouldn't know that it's even an option unless they were looking at the types or the source code. Even then, it would be tricky to know what the semantics are unless you have a pretty thorough understanding of how the editor is constructed and how listeners work.
It may even be worth a lint and/or a warning when this is not specified.