-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "inline" prop to Editable component #668
Conversation
Works great! I wonder if the footer in block quote should be the same.
|
I'm getting the the key warning now as well for the caption. Do you think I should just assign keys in |
Should we use the |
Hmm, I see what you're saying in the sense that the heading block shouldn't allow paragraph roots. In practice, this doesn't occur though; I'm assuming TinyMCE is preventing the paragraphs as descendants of the heading, but not here with a Broadly speaking, I'd agree it probably makes sense that Heading's |
I'm going to take a closer look at these warnings today. I'm not sure yet exactly how we'll want to address. |
Reflecting on the conversation here, I think considering There are some implications now on blocks which previously wouldn't have had an Enter newline behavior now inserting a |
Hm, do we want line |
I alluded to this in my previous comment; probably not, but I think we'll want to expand on this separately by exposing more control to the block to define its newline behavior. Given this, I still think the Editable input itself makes most makes semantic sense as an inline field, child of the root heading element. |
Just thinking out loud, maybe to better differentiate the different possibilities of the |
I'm generally fine with props controlling the behavior, but I'd agree the distinction between |
I've been looking at this some more, and I think assigning keys is a reasonable approach. |
Yeah. What about further down the tree? Should they all have keys? We're not taking advantage of reconciliation, so I guess not? |
Yes, but I don't think the keys need to be globally unique; it should be enough that they're assigned an index based only off their immediate parent. I do think assigning a preferred property to the DOM node is worth considering, in case we call |
This pull request seeks to add a new
inline
prop to the Editable component, used in controlling theforced_root_block
setting. With these changes, it's used to prevent the image'sfigcaption
from including paragraphs, assuming instead only inline nodes are allowed.Open questions:
What should happen when pressing Enter in an image's caption? Should it allow line breaks, or create a new text block after the image block? Is this specific to the Image block, or should this be a general behavior for any inline Editable?
@youknowriad I'm recalling a recent discussion where you'd mentioned accepting an
inlineFormattingControls
toolbar to theEditable
component. Should that be automatically inferred from this prop perhaps?Testing instructions:
Verify that pressing Enter in an image's caption results in line breaks, not paragraphs, at that there are no paragraphs in the serialized
figcaption
when changing to the Text view.figcaption
element of the image block you modified<p>
tags