Skip to content

Conversation

@nylen
Copy link
Member

@nylen nylen commented Jun 27, 2017

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 the isTypingInBlock selector are almost right for this, but the STOP_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 selector hasTypedInSelectedBlock 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.

@ellatrix
Copy link
Member

How about always displaying an empty text block at the end if the last one is not text or not empty?

@nylen
Copy link
Member Author

nylen commented Jun 27, 2017

How about always displaying an empty text block at the end if the last one is not text or not empty?

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.

@nylen
Copy link
Member Author

nylen commented Jun 28, 2017

I think this is superseded by #1553.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clicking the initial "Write your story" prompt marks a new post as dirty

3 participants