Repository navigation
Allow to pass all possible attributes to a content editable div - #4450
Merged
thegreatercurve merged 1 commit intoMay 3, 2023
Merged
thegreatercurve merged 1 commit into
thegreatercurve merged 1 commit into
Conversation
kazimirchuk
requested review from
acywatson,
fantactuka,
thegreatercurve,
tylerjbainbridge and
zurfyx
as code owners
May 3, 2023 14:05
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
thegreatercurve
left a comment
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
|
@thegreatercurve sure thing, makes sense 👍 Done in 46a1b15 ✅ |
kazimirchuk
force-pushed
the
propagate_all_attributes_in_contenteditable
branch
from
May 3, 2023 16:33
46a1b15 to
8d9a0af
Compare
thegreatercurve
approved these changes
May 3, 2023
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue
Currently the
ContentEditablecomponent 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 adivso 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