mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Update to latest squire build
This commit is contained in:
parent
0928d5f8ab
commit
db6aaee0dc
2 changed files with 34 additions and 2 deletions
|
@ -2228,6 +2228,37 @@ var onPaste = function ( event ) {
|
||||||
}, 0 );
|
}, 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 = [];
|
var instances = [];
|
||||||
|
|
||||||
function getSquireInstance ( doc ) {
|
function getSquireInstance ( doc ) {
|
||||||
|
@ -2328,6 +2359,7 @@ function Squire ( root, config ) {
|
||||||
this.addEventListener( isIElt11 ? 'beforecut' : 'cut', onCut );
|
this.addEventListener( isIElt11 ? 'beforecut' : 'cut', onCut );
|
||||||
this.addEventListener( 'copy', onCopy );
|
this.addEventListener( 'copy', onCopy );
|
||||||
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', onPaste );
|
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', onPaste );
|
||||||
|
this.addEventListener( 'drop', onDrop );
|
||||||
|
|
||||||
// Opera does not fire keydown repeatedly.
|
// Opera does not fire keydown repeatedly.
|
||||||
this.addEventListener( isPresto ? 'keypress' : 'keydown', onKey );
|
this.addEventListener( isPresto ? 'keypress' : 'keydown', onKey );
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue