If the clipboard contains block contents, e.g.
<blockquote><p>Foo</p></blockquote>
Then if you paste it into a block that already has content we merge the inline
content from the first block and discard its surrounding block.
However, if you paste into an empty block, we'll now keep the block and remove
the empty one in the document. This seems a reasonable heuristic for determining
user intent.
If the content hasn't changed before an undo point is requested we ignore the
request, but the cursor position may have changed and users expect undo to
restore the cursor position immediately before the requested change was made.
So in this instance we now still record an undo state, but replace the previous
one if the content is unchanged.
The selectionchange event handler can only be registered on the document
but we are not interested in changes of focus/selection that happen
outside of the editor, so check we have focus before firing the update
path event.
ms html clipboard format CF_HTML handles table like below if we copy part of table.
it makes problem when copying table from ms product such as ie, excel, powerpoint then pasting to squire.
<TABLE BORDER>
<!--StartFragment-->
<TR><TD>Item 6</TD><TD>Item 7</TD></TR><TR><TD>Item 10</TD><TD>Item 11</TD></TR>
<!--EndFragment-->
</TABLE>
and
<TABLE BORDER><TR>
<!--StartFragment-->
<TD>Item</TD>
<!--EndFragment-->
</TR></TABLE>
https://msdn.microsoft.com/en-us/library/windows/desktop/ms649015(v=vs.85).aspx#274
If an action modifies the selection while the editor is not focused, we cannot
immediately set it in the DOM as this triggers focus. So instead we cache it and
restore on focus. If getSelection is called before the editor is next focused,
we need to return this new selection, not the current DOM selection.
Fixes#259
* Data added to clipboard should now always be the same for cut as for copy
* Fixes bug when cutting across blocks, where not all parents would be included
in the data added to the clipboard
1. Fixes cursor position when deleting starting with a selection at beginning
of block.
2. Fixes block disappears when whole inline contents is deleted.