kogmbh/WebODF — pull request #626 by adityab (2014-06-04 18:52:37+00:00)
Title: Add a "Review Mode" editor variant

This PR brings some new frameworking to WebODF, including a `SessionConstraints` class from some of my previous work; the aim is to have an editor variant which lets you annotate a document (perhaps even collaboratively in an OT-rich future), and edit it (both text and direct formatting) in your own annotations and nowehere else. Selection and cursor movement is still possible elsewhere.

`SessionConstraints` allows you to "register" constraints (or permissions, or features -- a better name would be nice) and toggle them on/off in an existing session without requiring an editor reboot.

Every relevant controller now "registers" a constraint called `reviewMode`, set to `false` by default. Having each controller do this ensures as a practice that a controller can 'declare' the constraints it will need. Registering the same constraint multiple times across several controllers has no adverse effect; the constraint state is shared.

The enabling of a `reviewMode` constraint tells a controller to only generate operations for various kinds of edits if the cursor is within an annotation that has the same author as the cursor's owner.