-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Clicking the initial "Write your story" prompt marks a new post as dirty #1501
Comments
How would you check that the last block is not empty? I mean outside of the block context, we can't know. |
It's a good question, I didn't see a quick way to do it. The current behavior is honestly pretty annoying though. |
A user reported this issue in test: "I unintentionally created 3 extra blank blocks before properly adding the image blog" |
Hi, what if this is the intended behavior? User comes and clicks on 'Write your story'. The new and first block is appended to the state and so saved as a content. This I debugged this for a while. Maybe the last point is worthy of thinking about, although I can't imagine how much time would it take.
I would self-assign the issue, and really would like to work on it, but all of the solutions are a bit creepy. And I don't think there is some elegant solution for this 'maybe' issue. It's the saving flow, which would need a change. Quite time-demanding for such a small annoying issue. What do you think? |
@nitrajka What if we take a similar approach to Calypso (see https://github.com/Automattic/wp-calypso/blob/a70587157b33783ba4d5e0e4a1e136680d459d51/client/state/selectors/edited-post-has-content.js#L19-L21). Testing the HTML instead of testing the blocks and excluding empty paragraphs and comments (regexp) |
@youknowriad Yes, I thought about it but didn't think it is a correct solution for our case. |
I think we should test the entire post, if it has content or not, and assume that moving the post from |
@youknowriad makes sense. Thank you. Let's try it. |
Worth noting that in Calypso's case, it is specifically handling the fact that TinyMCE content will pad itself with paragraph and/or "bogus" |
That's a good point, maybe we could explicitly do so for text blocks only. |
Honestly, this feels like "Working as Intended" to me. Even if a block doesn't have readable content, the post has a block. If we consider emptiness as presence of any blocks, it follows that the post is not empty, even if the paragraph has no content. We could get into weeds of what it means for a block to be empty, but this seems like it'd eventually lead to either blocks implementing their own |
A block like paragraph could also have a "placeholder" set up. I still think it would be nice to not save so many new drafts just by clicking and clicking out. |
@aduth exactly. I've also written about it in my comment above. I also think it is intended behavior. @mtias Do you think, that the "placeholder" set up could/should solve the problem with saving drafts just by clicking (out)? |
@nitrajka if there are multiple placeholders set up (a heading, a paragraph, an image), those need (at the moment) to exist in the post content. |
@mtias Okay. I just wasn't sure how you meant it. So if I understand it well, the newly created post will already have some content, right? Will be such post considered as auto-draft or draft? |
Per last discussions cc @aduth , it seems that we want to consider A post with an empty paragraph as not empty and thus dirty. We do have the technical pieces to achieve this ticket pretty easily (with |
The following state was reached by simply clicking the "Write your story" / "Continue writing" placeholder multiple times:This seems undesirable. The "Continue writing" prompt should only appear if the last block in the post is not empty (and perhaps if it is not a text block).This part was fixed in #1553.Also, the first click on the initial "Write your story..." placeholder creates a text block, which marks a new post as dirty (note appearance of "Save" link in top left):
If possible it would be nice to avoid marking the post dirty in this situation.
The text was updated successfully, but these errors were encountered: