BUG: Fix the action buttons not rendering on upload.

Due to escaping API changes, a HTMLText instance was being incorrectly
casted to JSON.
BUG: Share session namespace with CMS main when adding documents.

The changes to the session management in 3.1 mean that editing when
uploading a document no longer worked as the page ID was not correctly
managed in the session. This addresses that issue by sharing a session
state with CMSMain.
Merge pull request #34 from ajshort/pull-2

Fixed upload issues in 3.1 (escaping and session)