0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-18 04:32:28 -05:00

Support pasting images in Edge

This commit is contained in:
Neil Jenkins 2017-12-13 16:43:43 +11:00
parent 50fb7c7c53
commit 070f2e52a3
3 changed files with 32 additions and 6 deletions

View file

@ -2278,8 +2278,21 @@ var onPaste = function ( event ) {
// --------------------------------- // ---------------------------------
// https://html.spec.whatwg.org/multipage/interaction.html // https://html.spec.whatwg.org/multipage/interaction.html
// Edge only provides access to plain text as of 2016-03-11. // Edge only provides access to plain text as of 2016-03-11 and gives no
if ( !isEdge && items ) { // indication there should be an HTML part. However, it does support access
// to image data, so check if this is present and use if so.
if ( isEdge && items ) {
l = items.length;
while ( l-- ) {
if ( !choosePlain && /^image\/.*/.test( items[l].type ) ) {
hasImage = true;
}
}
if ( !hasImage ) {
items = null;
}
}
if ( items ) {
event.preventDefault(); event.preventDefault();
l = items.length; l = items.length;
while ( l-- ) { while ( l-- ) {

File diff suppressed because one or more lines are too long

View file

@ -149,8 +149,21 @@ var onPaste = function ( event ) {
// --------------------------------- // ---------------------------------
// https://html.spec.whatwg.org/multipage/interaction.html // https://html.spec.whatwg.org/multipage/interaction.html
// Edge only provides access to plain text as of 2016-03-11. // Edge only provides access to plain text as of 2016-03-11 and gives no
if ( !isEdge && items ) { // indication there should be an HTML part. However, it does support access
// to image data, so check if this is present and use if so.
if ( isEdge && items ) {
l = items.length;
while ( l-- ) {
if ( !choosePlain && /^image\/.*/.test( items[l].type ) ) {
hasImage = true;
}
}
if ( !hasImage ) {
items = null;
}
}
if ( items ) {
event.preventDefault(); event.preventDefault();
l = items.length; l = items.length;
while ( l-- ) { while ( l-- ) {