Skip to content

Allow to pass all possible attributes to a content editable div - #4450

Merged
thegreatercurve merged 1 commit into
meta:mainfrom
kazimirchuk:propagate_all_attributes_in_contenteditable
May 3, 2023
Merged

thegreatercurve merged 1 commit into
meta:mainfrom
kazimirchuk:propagate_all_attributes_in_contenteditable

Conversation

@kazimirchuk

Copy link
Copy Markdown
Contributor

The issue

Currently the ContentEditable component is misleading because the interface for its props makes a union with all possible HTML attributes like so } & React.AllHTMLAttributes<HTMLDivElement> but at the same time doesn't pass them to the actual div its creating.

Essentially if you write a code: <ContentEditable autoCorrect="off" /> typescript won't complain because it's within the interface. However the attribute itself isn't passed down into a div so that's where the issue at.

Solution

I assume that it's totally fine to just pass the rest of the attributes for the lack of better context

@vercel

vercel Bot commented May 3, 2023 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 3, 2023 4:37pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 3, 2023 4:37pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 3, 2023

@thegreatercurve thegreatercurve left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put the spread at the start of the doc? I don't want people being able to override the attributes we are controlling in the component.

@kazimirchuk

Copy link
Copy Markdown
Contributor Author

@thegreatercurve sure thing, makes sense 👍 Done in 46a1b15 ✅

@thegreatercurve
thegreatercurve merged commit 7ee9890 into meta:main May 3, 2023
vyductan added a commit to vyductan/lexical-forked that referenced this pull request May 4, 2023
Allow to pass all possible attributes to a content editable div (meta#4450)
Revisit touch devices (meta#4441)
This was referenced May 23, 2023

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — 8d9a0afe Deployed May 3, 2023 by vercel[bot]
Preview – lexical — 8d9a0afe Deployed May 3, 2023 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants