Blog
Blog copied to clipboard
Save unsaved blog posts in local storage
Instead of dismissing the whole work, we can just put the whole blog post into the local storage (or give the option to save the draft to local storage).
This can also be done for already created blog posts where we additionally save the ID to make the mapping happen.
When you say local storage, are you mean the browser local storage?
Why not save in the blog database? Saving in local storage the writers won't be able to continue the article using another machine or browser, right?
What's the complexity to just set an status (draft | posted) on the post model?
That could be a way forward for sure. Yes, you are right, if we just put it into the local storage, you can't take it "with you".
The "problem" with saving it in the database is somewhat consistency. Right now if you call BlogPost.Create it checks all the validation - like is there a title, description, ...
Probably we would need a new domain object called DraftBlogPost that does have different logic.
In the editor you would create such draft blog posts and not the "real one". Only when you press "Publish" (in addition to save, what we currently have) then we create the new object.
I do think a clean cut between those two concepts is necessary - for sure we could somehow fit this in into the current "BlogPost" Container but it does not feel right.
Side note: Draft is already a state on BlogPost - but currently it is used to distinguish between things shown for all users vs things shown for the admin of the page.
With the new EasyMDE, this should work out of the box.