facebook / facebook/lexical

Feature: Automatically Adjust Table Column Widths Based on Content for New Tables

Open
#7,007 3 comments 8 reactions 0 assignees View on GitHub
enhancement tables
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
55

Description

## Problem Description

When a new table is created—whether through copy-pasting, markdown imports, or by loading fresh editor JSON without defined column widths—it often appears poorly formatted by default. Specifically, the column widths are not automatically adjusted to fit the content, leading to tables that are difficult to read and require manual resizing.

For example, in our project, we use markdown as the source of truth, which means we do not store column widths. As a result, every time a document is loaded into the editor, users have to resize table columns repeatedly, which is inefficient and frustrating.

## Proposed Solution

To improve the user experience, the editor should automatically calculate and apply column widths based on the table's content whenever no explicit widths are provided.

## Screenshots

**Current Behavior:**

When a table is created without specified column widths, the columns appear misaligned, as shown below:

![CleanShot 2024-12-30 at 18 06 25@2x](https://github.com/user-attachments/assets/e1b83d01-4b79-4ac0-9ff5-13cf96033e30)

**Desired Behavior:**
For comparison, when the same table is pasted into Notion, the column widths are automatically adjusted to fit the content:

![CleanShot 2024-12-30 at 18 09 06@2x](https://github.com/user-attachments/assets/d0627a89-499b-44df-8a72-c197b2804bb4)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.