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

Update to latest squire build

This commit is contained in:
Neil Jenkins 2016-05-26 13:43:43 +10:00
parent 0928d5f8ab
commit db6aaee0dc
2 changed files with 34 additions and 2 deletions

View file

@ -2228,6 +2228,37 @@ var onPaste = function ( event ) {
}, 0 );
};
// On Windows you can drag an drop text.
var onDrop = function ( event ) {
var dataTransfer = event.dataTransfer;
var types = dataTransfer.types;
var l = types.length;
var hasPlain = false;
var hasHTML = false;
while ( l-- ) {
switch ( types[l] ) {
case 'text/plain':
hasPlain = true;
break;
case 'text/html':
hasHTML = true;
break;
default:
return;
}
}
if ( hasHTML ) {
event.preventDefault();
this.insertHTML( dataTransfer.getData( 'text/html' ), true );
return;
}
if ( hasPlain ) {
event.preventDefault();
this.insertPlainText( dataTransfer.getData( 'text/plain' ), true );
return;
}
};
var instances = [];
function getSquireInstance ( doc ) {
@ -2328,6 +2359,7 @@ function Squire ( root, config ) {
this.addEventListener( isIElt11 ? 'beforecut' : 'cut', onCut );
this.addEventListener( 'copy', onCopy );
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', onPaste );
this.addEventListener( 'drop', onDrop );
// Opera does not fire keydown repeatedly.
this.addEventListener( isPresto ? 'keypress' : 'keydown', onKey );

File diff suppressed because one or more lines are too long