Local Page Cache Management Overview

We’d like to have edits auto-saved before they are explicitly saved. We can do this by using localStorage.setItem() so save the wiki page source whenever we’re editing and have paused for a bit (10 seconds). We’d like to cache the raw wiki content in case we lose the page before saving it. But this could result from browser crash so we persist the data the user hasn’t saved using webstorage method localStorage.setItem().

  • save node, user, raw content diff each time.
  • delete (or empty) this diff on save.
  • recover option when re-entering edit after losing edit window (crash, close etc).
    • view local version
    • view base version
    • view diff
    • apply diff

How to determine a diff is still valid. i.e. the base has not changed out from under you before you apply the diff.

Save raw content

Use the one_shot() function to call the localStorage.setItem when we paused (10 seconds) after editing. We can use it but seems we have to give it its own name oneshot_localStorage().

Clear value on save

When the user does push the save button then we can clear the localStorage. I seems we can only easily do this when we send the content to be saved. So we can fire this off when we submit the form.

METHOD:
* locate form - editForm id
* attach action on submit that removes the key,value for the localStorage

Manage (apply or discard) diff on re-entry to edit.

If we have a local version of a (page,version) when we enter edit mode for that person then present us with the option to view the diff between local and db stored version, and views of either piece individually. Finally, we want the option to apply or discard the diff

My tags:
 
Popular tags:
 
Powered by MojoMojo