First pass at enabling state restoration for the editor.

Fixes #778