Blog icon indicating copy to clipboard operation
Blog copied to clipboard

Save unsaved blog posts in local storage

Open linkdotnet opened this issue 2 years ago • 4 comments

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.

linkdotnet avatar Jan 08 '23 12:01 linkdotnet

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?

diegodrf avatar Aug 13 '23 12:08 diegodrf

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.

linkdotnet avatar Aug 13 '23 13:08 linkdotnet

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.

linkdotnet avatar Aug 13 '23 13:08 linkdotnet

With the new EasyMDE, this should work out of the box.

linkdotnet avatar Jun 12 '24 09:06 linkdotnet