Hide the "Continue writing" prompt if the last block is an empty text block #1502
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.content
works, 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_TYPING
action and theisTypingInBlock
selector are almost right for this, but theSTOP_TYPING
action triggers when you move the mouse away from the block, meaning that the placeholder would be hidden again. I've added a new selectorhasTypedInSelectedBlock
which "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.