[WIP] First steps to turn the default UI into plugins

Tests will be totally broken. This commit is just a spike to see whether
my idea (turning all the UI into plugins that just listen to standard
annotator events: annotationCreated, etc.) might work.

So far, the editor and viewer have been completely ignored, but the
adder and the highlights renderer have been extracted into two plugins:
Adder and Highlights respectively.

These two plugins don't depend on one another at all, and are
dramatically simpler than they were before (one obvious improvement is
that setupAnnotation no longer has to be all things to all people).

In order to make this work, I've moved the primary lifecycle events back
into the AnnotationRegistry, along with the load() function, which was
also originally there, too.
[WIP] Remove the wrapper element

I've realised while doing this refactoring that the only reason for
needing the wrapper element was as an offset parent for positioning UI
elements.

There's really no harm in just adding UI elements to the end of
document.body, at which point all we need to do is calculate the offset
of document.body and use that when positioning UI elements.

This commit removes the wrapper (and temporarily disables the viewer and
editor, which still depend on it) and updates the Adder and Highlights
plugins.
[WIP] Turn Viewer into an optional plugin

This commit extracts the majority of the viewer from the core of
Annotator. The viewer can now be triggered manually by other plugin
authors, or it can be used with the highlights plugin, in which case it
will automatically show when users hover over highlight elements.
Events: allow promise return values from event callbacks

This commit adds events.coffee, which exports Events, an extension of
BackboneEvents to include a `triggerThen` method which returns a
promise, fulfilled either when all the event callbacks have run, or, if
some of them return promises, that all the returned promises are
fulfilled as well.

This will make it possible to implement such things as
`beforeAnnotationDeleted` handlers that prevent the deletion, and, more
immediately, an Editor which can use `beforeAnnotationCreated` and
`beforeAnnotationUpdated` in order to present itself for editing.
Minor tweak to dev.html
Improve interface of AnnotationRegistry

- Observe the promise returned by triggering
  `beforeAnnotation{Created,Updated,Deleted}` events and only proceed to
  make the appropriate store calls if the promise is fulfilled.
- Remove the nasty event proxying, and simply trigger events on the core
  instance directly.
Add show{Edit,Delete}Button options to Viewer

These options can be toggled orthogonally to one another to change the
display of the viewer.
Make Editor into an independent plugin

This moves the last piece of user interface out of Annotator core and
into its own plugin. This was by far the most involved piece for two
main reasons:

1) Unlike Adder, Viewer, and Highlights, the Editor has the ability to
   interrupt the annotation lifecycle. The Adder requests an annotation
   be created, or the Viewer requests an annotation be updated, but the
   Editor has the ability to cancel that request.

   This problem has been solved by making the `before*` lifecycle events
   detect promises returned by their callback functions (see e90efe2),
   and abort the intended action if any of these promises are rejected.
   The Editor plugin hooks into `beforeAnnotation{Created,Updated}`, and
   displays the editor. If the editing is cancelled, the promise is
   rejected and the process aborts.

2) Like the Viewer, the Editor needs to know where to position itself.
   Unlike the viewer, its appearance is not (necessarily) triggered by a
   user mouse event from which we can extract the right position.

   This problem is solved by making both the Adder and the Viewer store
   the user's position in the `interactionPoint` property on Annotator
   core. If this property exists, the Editor will use it to position
   itself.

   This solution means that the Editor can be used solely with the Adder
   (without the Viewer) or indeed that it can be used with an entirely
   different type of adder plugin that sets `interactionPoint` in a
   different way.
Clean up Highlights plugin and fix test suites

Add a clean, isolated set of tests for the new Highlights plugin. The
existing tests were horrific, and extensively tested implementation
rather than interface. The new tests are much clearer.

This commit also makes the drawAll, draw, undraw, redraw methods on the
Highlights plugin public.
Clean up Adder plugin and fix test suites

Add a (relatively) clean, isolated set of tests for the new Adder
plugin.

This commit also makes show, hide, isShown public API on the Adder
plugin.
Fix AnnotationRegistry tests

Not calling the store functions until the next tick (because we wait for
the promise returned by triggerThen to be resolved) broke the tests,
which were assuming that the store methods would always be called
instantly.
Add missing clearFixtures() to adder tests
Make the widget property of Widgets a plain element
Clean up Viewer plugin and fix test suites

This commit cleans up the new Viewer plugin, and adds a much more
sensible set of tests for Viewer functionality.

Things changed:

- the readOnly option has been removed in favour of distinct
  showEditButton and showDeleteButton options
- the viewerHideTimeout functionality has been improved by
  distinguishing between hiding due to a passive user action (mousing
  off the viewer) and an active one (mousing over another highlight) and
  using different timeouts for each case
- The tests no longer reach deep into the internals of the plugin
  implementation...
Clean up Editor plugin and fix test suites

This commit cleans up the Editor plugin and adds some more sensible test
suites, much like the preceding commits for Adder, Viewer, Highlights.

Things of note here:

- Reenable the draggables (even though they are still broken, see #341)
- Add an `isShown()` method to the editor, for parity with the Adder and
  Viewer plugins
- Standardise on using the keypress event's `which` property, as this is
  the only one that jQuery promises to normalise
Fix broken Annotator#destroy() introduced by 1336fbb

Annotator.plugins is currently an object, not an array
Fix tests that don't clean up after themselves

- also, standardise plugin test suite names (from "Annotator.Plugin.Foo"
  to "Foo plugin")
- remove a couple of implementation tests from annotator_spec
Add back accessors for Editor and Viewer on core

This commit causes the Editor and Viewer plugins to create "editor" and
"viewer" properties on the core Annotator instance, in order to remain
compatible with plugins like Tags and Permissions that use these
properties to set up fields on the viewer and editor.

At the moment the deprecation warning suggests the developer switch to
using a method that currently *also* issues a deprecation warning, so
we're going to need to sort this out at some point...
Correct test logic for rejected promises

For an ES6-compatible promise, p.catch(rejectionCallback) returns a new
promise which resolves to the *return value of rejectionCallback*, i.e.
it *will* be resolved.

Fix this so that the tests in question do in fact throw when promises
are mistakenly resolved, but not all the time :)
Rewrite remaining setupAnnotation tests for Adder and Highlights

This commit also adds two new public methods to the Adder plugin, to
make it more useful to people not using it in the default configuration.
Specifically, the event handlers are now thin(ner) wrappers around
Adder.captureDocumentSelection() and Adder.create().