Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 791 Bytes

File metadata and controls

11 lines (6 loc) · 791 Bytes

Lexical element node based MDXEditor table plugin

This is an example of an MDXEditor table plugin that uses lexical element nodes to represent table structures.

Warning: Use this as a base for your own table plugin. Most of it is an adaptation of the original lexical table plugin, while removing parts that do not make sense for the markdown table nodes.

The problem

The built-in table plugin uses decorator nodes and nested lexical editors. Nested editors are quite complex to support in collaborative mode (they require nested collaboration plugins to be added).

The trade-off is that lexical element nodes are very restrictive. You cannot use React directly to add interaction to them. This makes building table tools complicated and somewhat brittle - see TableUI.tsx.