New Plugin: Autosave in Browsercache
New Plugin: Autosave in Browsercache
When logging into serendipity without the "remember me" setting enabled it happens that after some time one gets logged out. If writing an article at that time and trying to save it, the data is normally lost, as the browsers don't seem to properly cache the content of the textareas used. A disconnect can have the same effect.
We already have the autosave-plugin for that, but it never worked for me. I also disliked the approach to save the data on the server, as this will also fail on a disconnect.
The attached plugin will save the content of both the normal editor and the extended one automatically every 5 seconds in the browser, using indexeddb. This is supported by all modern browsers (http://caniuse.com/#feat=indexeddb), bot not on mobile devices thus far.
I aim to integrate it into 2.0, but it should work on 1.7 as well. Would be nice if someone can write whether it works for him.
We already have the autosave-plugin for that, but it never worked for me. I also disliked the approach to save the data on the server, as this will also fail on a disconnect.
The attached plugin will save the content of both the normal editor and the extended one automatically every 5 seconds in the browser, using indexeddb. This is supported by all modern browsers (http://caniuse.com/#feat=indexeddb), bot not on mobile devices thus far.
I aim to integrate it into 2.0, but it should work on 1.7 as well. Would be nice if someone can write whether it works for him.
- Attachments
-
- serendipity_event_autosave_local-0.1.tar.gz
- (1.52 KiB) Downloaded 476 times
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: New Plugin: Autosave in Browsercache
Hi!
I'd love to not have two plugins for that, but rather offer an option in the autosave plugin to do the local saving. I'd also opt for making that the default option, since autosaver was always really heavy on the complexity side
Or do you mean you want to integrate this functionality into 2.0 not as a plugin but a core thing? So that you wouldn't want to put this as a plugin into spartacus? (Fine with me as well, I do think this could be core functionality!).
Regards,
Garvin
I'd love to not have two plugins for that, but rather offer an option in the autosave plugin to do the local saving. I'd also opt for making that the default option, since autosaver was always really heavy on the complexity side
Or do you mean you want to integrate this functionality into 2.0 not as a plugin but a core thing? So that you wouldn't want to put this as a plugin into spartacus? (Fine with me as well, I do think this could be core functionality!).
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: New Plugin: Autosave in Browsercache
Yes, I thought that having this functionality as one of the default-plugins in 2.0 would be a good idea. I even thought about writing this directly into the core, but this wouldn't make it easier, having it as a plugins fits better. Though the javascript for the cache proabably fits into serendipity_editor.js.tpl, we could use it in other places as well.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: New Plugin: Autosave in Browsercache
Hi!
I'm just thinking of the overhead it imposes to the event plugin (RAM), and since it's a rather small functionality, it feels a bit odd to have it as a plugin?
I think adding this directly to the core backend template and wiring it into serendipity_editor.js would be better for the user, because otherwise we also need upgrader functions to install the plugin automatically, etc... sounds like maintenance hell, for both developers and users
(I do think this is functionality that no one would actually turn off or NOT need, so I think forcing it on the user shouldn't hurt?)
Regards,
Garvin
I'm just thinking of the overhead it imposes to the event plugin (RAM), and since it's a rather small functionality, it feels a bit odd to have it as a plugin?
I think adding this directly to the core backend template and wiring it into serendipity_editor.js would be better for the user, because otherwise we also need upgrader functions to install the plugin automatically, etc... sounds like maintenance hell, for both developers and users
(I do think this is functionality that no one would actually turn off or NOT need, so I think forcing it on the user shouldn't hurt?)
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: New Plugin: Autosave in Browsercache
Ok. I am a bit surprised, but that is fine :)
Let's wait if we get some reports. Maybe it proves to be less hassle free than we expect. But if everything goes fine, we or I can add this to the core later on (But yes, I expect that no harm is possible, if the machine isn't really really slow).
The whole functions_entries and the preview_iframe-area needs to get some work in regard of the smartification anyway.
Let's wait if we get some reports. Maybe it proves to be less hassle free than we expect. But if everything goes fine, we or I can add this to the core later on (But yes, I expect that no harm is possible, if the machine isn't really really slow).
The whole functions_entries and the preview_iframe-area needs to get some work in regard of the smartification anyway.
Re: New Plugin: Autosave in Browsercache
FYI: There seems to be a problem if an old entry is modified. Sometimes it can be, that the entry-part is overwritten by old content of autosave-cache.
For the moment, it could be better to disable the plugin until there is an update available.
For the moment, it could be better to disable the plugin until there is an update available.
Re: New Plugin: Autosave in Browsercache
Thanks for the report Bernd. What was missing was logic to not replace text in the textarea, i added that now.
- Attachments
-
- serendipity_event_autosave_local-0.1.1.tar.gz
- (1.54 KiB) Downloaded 427 times
Re: New Plugin: Autosave in Browsercache
Better directly use this version. It toggles the extended editor if it inserts something in it, and doesn't insert the cache into the extended editor if the normal editor has already text, thus preventing mixing old with new entries.
- Attachments
-
- serendipity_event_autosave_local-0.1.2.tar.gz
- (1.56 KiB) Downloaded 474 times
Re: New Plugin: Autosave in Browsercache
I integrated this into the 2.0 core (including adjustments necessary for it to work in ckeditor) in https://github.com/s9y/Serendipity/comm ... 80a03e18c9
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: New Plugin: Autosave in Browsercache
Hey,
this is awesome, thanks for committing.
Seems to work great in my browser. Maybe everyone could test this out and see if it creates trouble in maybe older browsers...
Thanks,
Garvin
this is awesome, thanks for committing.
Seems to work great in my browser. Maybe everyone could test this out and see if it creates trouble in maybe older browsers...
Thanks,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: New Plugin: Autosave in Browsercache
It could also create issues when writing really long articles on some setups, that would be interesting too. Not on my setup though.
Re: New Plugin: Autosave in Browsercache
Great stuff! It works for me, saves and loads both body and extended body from IndexedDB. Would it make sense to save the entry title, too?
Re: New Plugin: Autosave in Browsercache
- Prologue: I have never understood why an autosave was a need. IMHO open forms keep unsafed entries... and this is a default behaviour.
I don't like that! If I do such a page change, I do want a new entry form, nothing else.
Can this autosave feature be made optional, please?! Since this originally was an option by installing it as a plugin, even if that didn't work that good.
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Re: New Plugin: Autosave in Browsercache
Yes, it should be possible to save the title as well (either making the code more generic or more specific, I'll think about that).
That is sadly just not true, especially in case of disconnects.IMHO open forms keep unsafed entries... and this is a default behaviour.
Yes.Is that the suggested behaviour?
If I don't miss something specific, it is impossible to distinguish this action from a normal pageload of the editor, that would happen in case of a disconnect. And besides, to keep the text is the whole point of this functionality.If I do such a page change, I do want a new entry form, nothing else.
We could easily add an option to disable it.Can this autosave feature be made optional, please?!
Re: New Plugin: Autosave in Browsercache
That is why I wrote "open forms". I have to admit this disconnect in special while writing a new entry has never happenend to me (or I have learned to avoid). And I do not use the remember me option.onli wrote:That is sadly just not true, especially in case of disconnects.IMHO open forms keep unsafed entries... and this is a default behaviour.
Well, what I meant was, if I do such an approach I want a new empty form!onli wrote:If I don't miss something specific, it is impossible to distinguish this action from a normal pageload of the editor, that would happen in case of a disconnect. And besides, to keep the text is the whole point ofIf I do such a page change, I do want a new entry form, nothing else.
Better to turn it ON, IMHO. Maybe we can get some more means here, since that really is a change for every user. And this is nothing against this elegant indexedDB solution!onli wrote:We could easily add an option to disable it.Can this autosave feature be made optional, please?!
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian