Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Save draft comments (with configurable autosave)
Stash
✭
I'm sure that this has happened to all of us at least once, so...
I guess this really begs for a new "autosave" extension for Vanilla that saves the contents of the comment box to a cookie (?) every 30 (?) seconds. Then you could have a "load comment from autosave" button near the "big input" button currently?
When you post successfully the cookie could be cleared, otherwise it could just store the info and automatically load it up into the comment box when you go to a discussion.
If security is an issue with saving to cookies, what abut encrypting it before saving? Is there a better idea than cookies? Actually the next bit kinda begs for something different...
If there was a "save draft comment" button that you could manually press, this would be pretty cool as well — and then maybe an area for your "comment drafts"... feature creep anyone?
I'm sure this is a complete swine of an extension to make, but it would be pretty cool.
I guess this really begs for a new "autosave" extension for Vanilla that saves the contents of the comment box to a cookie (?) every 30 (?) seconds. Then you could have a "load comment from autosave" button near the "big input" button currently?
When you post successfully the cookie could be cleared, otherwise it could just store the info and automatically load it up into the comment box when you go to a discussion.
If security is an issue with saving to cookies, what abut encrypting it before saving? Is there a better idea than cookies? Actually the next bit kinda begs for something different...
If there was a "save draft comment" button that you could manually press, this would be pretty cool as well — and then maybe an area for your "comment drafts"... feature creep anyone?
I'm sure this is a complete swine of an extension to make, but it would be pretty cool.
0
This discussion has been closed.
Comments
boy, searching for it here found me recommending it three times for this function. Now, where did I put it?
So:
- Have a simple naming structure for cookies like CommentSave-21 (where 21 is the discussion ID) and DiscussionSave-2 (where the number is incremental for each discussion draft).
- Some crude encryption
- Auto saves every 30 of seconds
- "Save draft" button
- Disable per user, per role, and globally
- If there is a draft available for a discussion it adds a button to the bottom of the input form, or something saying "Load draft" which fills in the input when clicked (similar with a new discussion, but it will offer a list, like "Load draft 1, Load draft 2" maybe (or just one draft, to keep things simple)
- Destroys draft if you make a post to a discussion
- The cookies for the drafts have an expiry (day, two days?)
- Ability to forceably remove all drafts
Anything else do you think?Perhaps drafts of new discussions should be saved differently, to the database perhaps? (but auto save to a cookie? ugh, dunno).
Adam.
From point six above, if there is a saved comment, perhaps the comment box should just autoload the draft? That means only one draft, but it would be simple as hell There could perhaps be a red warning box just above the comment box, something like...
You can start editing or adding to the comment and post it as usual.
Alternatively, you can:
P.S. three and eight should be admin (user?) configurable and done with JS — again to prevent server load.
Also, if you use cookies, all drafts will be sent to the server and back to the client on each load; that will more bandwidth consumption and slower load. Flash can be used instead. Without special user permission, you can store 100k on the user computer I heard.
Not sure I like the idea of using Flash like that, but it's certainly worth a look I guess...
I still feel that cookies are the logical way to go, they are there for storing data unique to the client for a finite period in time. That is exactly what we intend to do, store data for the client, until they no longer need it.
Other ways to reduce load on the server could be, only storing data when it becomes X amount bigger than it was the last time it were checked (this could be checked in javascript), only store data if there has been a new fullstop (or comma) character added since it were last checked (could probably also be checked in js), only store if a new line break is added (js again). Endless possibilities.
Adam.
The cookie is a good idea especially if it is only a temporary storage and that on each load the draft(s) is/are saved in the database (and the cookie unset). If you want to do everything on the client side, try to find a way to not send the drafts to the server (using Flash, using the path parameter of the cookie and an iframe, Dojo storage...). For a first version, you could just not bother and see if it is really a problem.
Anyways, this extension isn't going to be started by me for some time - I have too much on to do it at the moment, though I can see myself picking it up in the future if development hasn't begun.
Adam.
I would like to use this extension for sure so I'm putting it into my todo list and if nobody is going to develope this until I reach that todo line, I'll do it myself.
well, have you seen my todo list already? it's on my account page SaveDraft is #7 #1, #2 and #3 are not far from finish
I look forward to #8, I've been using pluginstalled with some success in WordPress, and would love to see something similar for Vanilla. It's got some "wonderful" quirks, hopefully yours won't!
Also see here.
A possibility for the dirty work would be to save it as a comment, but remove that such comment from all views. (I was looking at the code for PreModeration, and it looks like that's exactly what it does.) That would guarantee compatibility with addons like Attachments2.