Add OT for InsertText and SplitParagraph at the same position.

The person typing text should keep typing in the same line
without any unexpected jumps.
The person splitting the paragraph should get that without having
the other typing in the new one.

Also added tests for all 3 position cases (before, same, afteR)
in InsertTextSplitParagraph.
Merge pull request #546 from adityab/split-insert-ot

Add OT for InsertText and SplitParagraph at the same position.
Add test showing reproducible crash when using dictation on OSX 10.9

Dictation engines enter new data via the same IME mechanism that multi
-language support uses. In this particular instance, the dictation
program supports the phrase "new paragraph" or "new line", which causes
it put a new-line character in the event trap, which the IME handling
happily converts directly into an InsertText op with a new line.
Allow insert text op to gracefully cope with strange whitespace

If an insert text operation is created that contains non-tab non-space
whitespace characters (e.g, \r\n etc.), these will now be treated as if
they were simply space characters and inserted accordingly. A warning
is logged for diagnostics purposes.

This prevents crashing on unexpected behaviour because the number of
inserted steps is consistent with the operation's text length.
Support text composition events that contain line breaks

Using the paste-handler for text that contains new lines
allows the inserted text to correctly create new paragraphs
as necessary.
Optimize paste handling to only create new paragraphs if necessary

If there is only a single line of text, there is no need to split and
then rejoin any paragraphs. The pasted text can simply be inserted via
an insert text operation directly.
Merge pull request #547 from peitschie/dictation-crash

Support text composition events that contain line breaks
Add core.UnitTest.createXmlDocument, to reduce duplicated code
Merge pull request #544 from kossebau/reduceDuplicationOfXMLTreeGenerationInTests

Add core.UnitTest.createXmlDocument, to reduce duplicated code
Only expand selection on multiple clicks with the primary mouse button

Chrome + WebKit increment the click count value for the MouseEvent even
if the user switches buttons. E.g., a double click then right click
will report the last event as {button: 2, detail: 3}, causing the
selection to expand to the paragraph bounds.

Now, the click count is only reported as non-zero if the current event
is with the primary mouse button (left by default, or the right button
if the user has switched their primary mouse button around).
Add todo for existing flaw in mouse-selection click handling
Merge pull request #525 from peitschie/right-click-expand

Only expand selection on multiple clicks with the primary mouse button
Slight optimization: use Date.now() instead of (new Date()).getTime().
This avoids creating a new date object that is discarded immediately.
Whitespace fix.
Merge pull request #542 from vandenoever/datenow

Slight optimization: use Date.now() instead of (new Date()).getTime().
Add additional namespaces to OdtDocumentTests
Add a check to ensure document length is constant during position tests
Add additional checks around space elements
Preserve cursor step after annotation start when annotations are shown

Rendering annotations causes the number of available cursor positions
to be reduced by one. The original rule was added to stop the cursor
getting in between the annotation highlight span and the annotation end.
Rather than moving the valid cursor position to inside the span, this
simply removed the position entirely.

This patch adds additional logic to allow the cursor to stop just inside
the annotation's highlight span so the number of positions in the doc
stays consistent regardless of whether annotations are shown or not.

Incidentally, this also fixes issue #51.
Only update the cursor selection once per mouse-down

In Chrome, right-clicking repeatedly generates both a contextmenu AND
a mouseup event for subsequent clicks. E.g. a sequence of right clicks
generates:
1st - mousedown, contextmenu
2nd...nth - mousedown, contextmenu, mouseup

This causes problems when clicking on images as the selection is
immediately reset after being processed by the first context menu,
causing the subsequent mouseup event to try and reset the cursor
selection *again*.