Merge pull request #118 from peitschie/imgselection

Support image selection  (rebased #108)
Ensure the cursor is in a walkable state after applying direct styling

Due to how text splitting works, the cursor is often left outside the
span, resulting in:
<p>|A|<span>B</span>|C|</p>

According to README_cursorpositions.txt, the cursor position near a span
is after the last character in the span. I.e.,:
<p>|A|<span>B|</span>C|</p>

The fix for this is to fix the cursor positions after the operation has
been executed
Add support for cursor-styling

Cursor styling allows the direct styling properties of the next inserted
text to be set. This means that the user can set text-related properties
(e.g., bold, underline, italic) without having an existing selection,
and the next entered character will have this formatting applied to it.

Known issues
- Undo/redo requires multiple steps. Should only be one. But, the current
undo manager design is not amenable to this type of change.
Refactored StyleHelper text queries (isBold etc.) to use a applied styles object

This improves the performance by reducing the number of times getAppliedStyles
is called (once per update, rather than once per property to check), and
paves the way for the direct cursor styling to be taken into account.
Refresh the style information cache to account for any direct cursor styling
Use text insertion event to add styling op to insert text operation group

Using the insert text operation group ensures the direct styling op is
executed immediately after the insert text operation is. In some session
queues, operations could potentially be executed much later, which would
cause the previous implementation to incorrectly append the styling op
at the end of the list, rather than after the insert text op.