Last week, it snowed pretty heavily at my house.  Two days of snow was followed by two days of ice.

News alerts warned us to stay at home.  My wife worked from the living room rather than brave the freeway.  We walked the mile to the store for groceries.  It was refreshing to not be on the go all the time.

Then my network died.

The problem with ice: it takes out power lines.  Even if it leaves my power alone, it can take out the power to the fiber optic relay hub that provides me with connectivity and completely cut me off from the outside world.  Like it did Friday night.

Doesn't the weather know I have a blog to write?

Working Offline

My favorite feature in Google Docs is the ability to work offline.  I still use Chrome, but I can work on existing documents - or create new ones - while completely disconnected from the network.

The next time I have connectivity, everything syncs and my work is backed up.  I've only had this workflow not work once; I've been using it otherwise problem-free since the feature first shipped.

I would love to do the same in WordPress.

The Vision

No, I don't have a plugin or a Gist to show you working code - mostly because I'm not even sure how to implement this just yet.  I just have a dream and a desire, and I want to share that in the hope someone else can help me draft up an implementation plan.

My goal would be:

  • Navigate to my site in a browser
  • Be alerted that I'm offline
  • Edit existing content while offline (saving changes to a cache)
  • Create new content while offline (saving content to a cache)
  • Auto-sync my content with the live server when I'm online again

I do know there was a WordPress GSoC project for a feature to detect when connectivity is lost.[ref]I also seem to remember talk of a similar feature actually in core ... but I can't find references to it, so I'm probably just remembering the discussion around this project instead.[/ref]  This feature will store the post you're currently working on in localstorage and re-sync with the server when the network's restored.

My goal would be to extend this and provide a richer app experience.  It would likely involve a JS-powered (slimmed down) version of the WordPress admin that could run locally.  Probably something built on Ember or Angular or Backbone, using pluggable templates for rendering markup.

Again, localstorage would come into play for storing posts, both drafts and otherwise.

I can visualize most of it in my head already - just not authentication.  On the one hand, WordPress auth cookies could be used to authenticate the request just fine.  But if the entire editor is in the browser I fear we're opening sites up to further potential for cross-site scripting attacks or man-in-the-machine/browser extension vulnerabilities.

What would you want to see in an offline editor for WordPress?  How would you approach building it?  Would it be a core feature, plugin material, or something else entirely?