0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Workaround Facebook iOS URL copying bug

This commit is contained in:
Neil Jenkins 2016-04-11 16:58:13 +10:00
parent 44a2b5c7a8
commit e3d0576a38
3 changed files with 13 additions and 5 deletions

View file

@ -2136,10 +2136,14 @@ var onPaste = function ( event ) {
event.preventDefault(); event.preventDefault();
// Abiword on Linux copies a plain text and html version, but the HTML // Abiword on Linux copies a plain text and html version, but the HTML
// version is the empty string! So always try to get HTML, but if none, // version is the empty string! So always try to get HTML, but if none,
// insert plain text instead. // insert plain text instead. On iOS, Facebook (and possibly other
// apps?) copy links as type text/uri-list, but also insert a **blank**
// text/plain item onto the clipboard. Why? Who knows.
if (( data = clipboardData.getData( 'text/html' ) )) { if (( data = clipboardData.getData( 'text/html' ) )) {
this.insertHTML( data, true ); this.insertHTML( data, true );
} else if (( data = clipboardData.getData( 'text/plain' ) )) { } else if (
( data = clipboardData.getData( 'text/plain' ) ) ||
( data = clipboardData.getData( 'text/uri-list' ) ) ) {
this.insertPlainText( data, true ); this.insertPlainText( data, true );
} }
return; return;

File diff suppressed because one or more lines are too long

View file

@ -131,10 +131,14 @@ var onPaste = function ( event ) {
event.preventDefault(); event.preventDefault();
// Abiword on Linux copies a plain text and html version, but the HTML // Abiword on Linux copies a plain text and html version, but the HTML
// version is the empty string! So always try to get HTML, but if none, // version is the empty string! So always try to get HTML, but if none,
// insert plain text instead. // insert plain text instead. On iOS, Facebook (and possibly other
// apps?) copy links as type text/uri-list, but also insert a **blank**
// text/plain item onto the clipboard. Why? Who knows.
if (( data = clipboardData.getData( 'text/html' ) )) { if (( data = clipboardData.getData( 'text/html' ) )) {
this.insertHTML( data, true ); this.insertHTML( data, true );
} else if (( data = clipboardData.getData( 'text/plain' ) )) { } else if (
( data = clipboardData.getData( 'text/plain' ) ) ||
( data = clipboardData.getData( 'text/uri-list' ) ) ) {
this.insertPlainText( data, true ); this.insertPlainText( data, true );
} }
return; return;