RFC: Tables in the Lexical Editor #8037
Closed
GermanJablo
started this conversation in
Feature Requests & Ideas
Replies: 1 comment
-
I'm abandoning this idea. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This RFC explores the possibility of enhancing the table functionality within the Lexical editor by allowing users to integrate their preferred table libraries with minimal modifications. Below is a curated list of grid, table, and spreadsheet libraries reviewed during research:
These libraries offer a broad range of complex features such as virtualization, keyboard navigation, accessibility, sorting, filtering, resizing, creating, deleting, reordering, hiding rows/columns, protected ranges, formulas, and more. Many of these libraries are maintained by dedicated teams of engineers, highlighting the complexity and effort required to develop and maintain them.
Why is This Relevant to Payload?
Currently, Payload uses the official Lexical table package. In Lexical there are two ways to model data:
The table package uses the second approach. That's why you have TableNode, RowNode and CellNode that mimic
table
,tr
andtd
. While functional, this approach ties the editor tightly to the Lexical-specific implementation, limiting flexibility and customization.Proposal: Decoupling Table Implementation
I've been advocating for a while now that text editors shouldn't waste time maintaining table and code blocks. A text editor is arguably already the most difficult UI component to develop, so it's good to decouple it from the responsibility of tables and code editors which also have so many different implementations and endless possibilities.
I'm glad that Payload hasn't incorporated the Lexical code block, and instead, the idea of embedding the Monaco component is being explored. I would like to propose doing the same with tables.
My idea is that, regardless of the table library we choose, the serialization of the DecoratorNode (methods
importJSON
andexportJSON
) will be to a versatile and universal table format, such asCSV
.This approach allows seamless switching between table libraries by serializing to a common format, eliminating the need for migrations or breaking changes.
We would also have to decide the format of the cell content, which could be Lexical-json, markdown or html, but that discussion can take place later.
Benefits
Considerations
content-editable: false
. That means that the selection cannot start inside the table and end outside, or vice versa. In my opinion, this may turn out to be more of an advantage than a disadvantage. I don't see why anyone would want to start the selection inside and end it outside the table.Beta Was this translation helpful? Give feedback.
All reactions