lexical
lexical copied to clipboard
Feature Support for non-contiguous table cell selection (multi-select with Cmd/Ctrl+Click)
Description
Hello! I would like to request support for non-contiguous table cell selection in Lexical tables, similar to the functionality available in spreadsheet applications like Excel, Google Sheets, and Drobbox Paper
Currently, the TableSelection model only supports rectangular/contiguous selections defined by a bounding box (fromX, toX, fromY, toY). This means users cannot select multiple non-adjacent rows or columns using modifier keys (Cmd/Ctrl+Click).
Use cases
- Bulk formatting: Users want to apply the same formatting (background color, text style) to multiple non-adjacent rows/columns
- Data operations: Delete, copy, or move multiple non-contiguous rows/columns at once
- Table reorganization: Select specific rows scattered throughout a table for bulk operations
- Improved UX parity: Matches user expectations from Excel, Google Sheets, Paper, etc.
Context / considerations
- May require extending the TableSelection class to store an array of selected cell ranges rather than a single bounding box
- Would need updates to selection rendering/highlighting to support non-contiguous cells
- Commands that operate on selections would need to handle non-rectangular selections
| Sheets | Paper |
|---|---|
Impact
- Any users working with tables in Lexical-based editors
- Applications that need spreadsheet-like functionality (data tables, planning tools, CMS systems)
- This would be used regularly by power users working with data-heavy tables
- Particularly valuable in collaborative editing tools, project management apps, and document editors with complex tables
I think this feature makes sense, but it does essentially require a backwards incompatible reimplementation of TableSelection and related functionality.