-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fixed RichText placeholder whitespace. #5035
Conversation
642d8df
to
5b52913
Compare
I think the original issue can also be seen when saving a post with empty paragraphs and refreshing? There's additional space around the empty blocks until cursor moves over them. Initial testing reveals this is improved by this branch. Still a brief flicker of height-changing. |
5b52913
to
a4a935c
Compare
The RichText CSS uses a rule based on attribute data-is-placeholder-visible. The TinyMce component was just setting this attribute when componentWillReceiveProps is invoked while it should also set on the first render for the first props received.
a4a935c
to
5f34816
Compare
Hi @aduth, nice catch code was updated instead of using mount event we are now setting the attribute directly on render. The attribute should now immediately appear. |
When was this introduced? |
Not certain but it seems to be a very old problem, even before the attribute was named data-is-placeholder-visible we used data-is-empty and it looks like in that attribute data-is-empty we also had that problem. So it does not seems like a regression, probably the problem become more noticeable recently because of some design change. |
Yeah, I've seen this bug only just recently, so it just seemed like a regression. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, the only effective change here is including the data-
prop in the render result?
I could see how this might have always been an issue, if we'd relied on the fact that componentWillReceiveProps
would always have been called to "correct" the appearance (might also explain why it's intermittent).
Makes sense to me 👍
Yes that's the only effective change. The refactor to an external function of the placeholder in componentWillReceiveProps was part of a different approach to solving this problem. And as the change was done when reverting I kept it because it makes sense. |
Thanks for these changes @jorgefilipecosta! |
The RichText CSS uses a rule based on attribute data-is-placeholder-visible. The TinyMCE component was just setting this attribute when componentWillReceiveProps is invoked while it should also set it after the first mount for the first props received, after TinyMCE setup is complete. So the attribute was missing while the component did not receive new props. This PR fixes that bug.
How Has This Been Tested?
Add an image block with an image, focus the title of the post then click on the image. Verify no empty space appears between the image and the placeholder. It may not be easy to replicate the bug, trying with a small 300x300 image made things easier to replicate.
Verify other uses cases of RichText and see no regression happens.
Create a new post verify there is no big whitespace in the paragraph that disappears, on mouse hover.
Screenshots (jpeg or gifs if applicable):