0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Handle browser splitting paste area.

Fixes #88.
This commit is contained in:
Neil Jenkins 2015-06-09 16:32:20 +07:00
parent 884f352846
commit 60169dce6b
3 changed files with 30 additions and 10 deletions

View file

@ -3117,10 +3117,20 @@ proto._onPaste = function ( event ) {
setTimeout( function () {
try {
// Get the pasted content and clean
var frag = empty( detach( pasteArea ) ),
first = frag.firstChild,
range = self._createRange(
startContainer, startOffset, endContainer, endOffset );
var frag = self._doc.createDocumentFragment(),
next = pasteArea,
first, range;
// #88: Chrome can apparently split the paste area if certain
// content is inserted; gather them all up.
while ( pasteArea = next ) {
next = pasteArea.nextSibling;
frag.appendChild( empty( detach( pasteArea ) ) );
}
first = frag.firstChild;
range = self._createRange(
startContainer, startOffset, endContainer, endOffset );
// Was anything actually pasted?
if ( first ) {

File diff suppressed because one or more lines are too long

View file

@ -1685,10 +1685,20 @@ proto._onPaste = function ( event ) {
setTimeout( function () {
try {
// Get the pasted content and clean
var frag = empty( detach( pasteArea ) ),
first = frag.firstChild,
range = self._createRange(
startContainer, startOffset, endContainer, endOffset );
var frag = self._doc.createDocumentFragment(),
next = pasteArea,
first, range;
// #88: Chrome can apparently split the paste area if certain
// content is inserted; gather them all up.
while ( pasteArea = next ) {
next = pasteArea.nextSibling;
frag.appendChild( empty( detach( pasteArea ) ) );
}
first = frag.firstChild;
range = self._createRange(
startContainer, startOffset, endContainer, endOffset );
// Was anything actually pasted?
if ( first ) {