Hide the "Continue writing" prompt if the last block is an empty text block#1502
Closed
Hide the "Continue writing" prompt if the last block is an empty text block#1502
Conversation
Member
|
How about always displaying an empty text block at the end if the last one is not text or not empty? |
Member
Author
Seems fine to me, and this could also fix the issue with post content being marked dirty after a single click inside the empty content area. Though it seems we will face some of the same challenges in this PR around empty detection, and we will need to make sure the last empty block is not serialized. I will take another look later, but I could use some help with the rest of this one. |
Member
Author
|
I think this is superseded by #1553. |
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.
Partially fixes #1501 (apart from the post being marked dirty when the first text block is inserted).
The first commit handles the majority of the work: looking at the last block to determine whether it is an empty text block. The empty detection using
!! lastBlock.attributes.contentworks, but ideally the block list shouldn't be so aware of the internal details of the text block.The second commit causes the "Continue writing" placeholder to appear again when you start typing inside an empty text block. The
START_TYPINGaction and theisTypingInBlockselector are almost right for this, but theSTOP_TYPINGaction triggers when you move the mouse away from the block, meaning that the placeholder would be hidden again. I've added a new selectorhasTypedInSelectedBlockwhich "remembers" this value for a bit longer. I'm not very happy with this code either, but I think it is demonstrating the correct behavior.