Apply placeholder on editable wrapper #758
Closed
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.
Previously: #756, #475, specifically #475 (comment)
This pull request seeks to simplify the placeholder implementation slightly by moving it up one level to the base
Editable
component's wrapper. This avoids needing to manage lifecycle to apply attributes to the TinyMCE node directly.Open questions:
Should the placeholder be centered by default? This makes sense for the image caption, but I'd first experimented with applying it to the heading block, where it felt off (I'd have expected left-aligned). I guess this depends on where we expect placeholders to be used.
When I tried applying placeholder to heading, I found it doesn't always work correctly when removing text from an existing header then focusing out (shown empty instead of with placeholder).
Testing instructions:
There should be no regressions from #756. Notably, you should be able to focus an image block and see a placeholder shown 'til text is entered.