Skip to content
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

Save unsaved blog posts in local storage #150

Open
linkdotnet opened this issue Jan 8, 2023 · 4 comments
Open

Save unsaved blog posts in local storage #150

linkdotnet opened this issue Jan 8, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@linkdotnet
Copy link
Owner

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 linkdotnet added the enhancement New feature or request label Jan 8, 2023
@diegodrf
Copy link

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?

@linkdotnet
Copy link
Owner Author

That could be a way forward for sure. Yes, you are right, if we just put it into the local storage, you can 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
Copy link
Owner Author

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
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants