mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 13:16:31 -05:00
Workaround Firefox clipboard ignores RTF data
This commit is contained in:
parent
9b88aca813
commit
6ed3b93900
3 changed files with 27 additions and 11 deletions
|
@ -2003,7 +2003,7 @@ var onPaste = function ( event ) {
|
||||||
hasImage = false,
|
hasImage = false,
|
||||||
plainItem = null,
|
plainItem = null,
|
||||||
self = this,
|
self = this,
|
||||||
l, item, type, data;
|
l, item, type, types, data;
|
||||||
|
|
||||||
// Current HTML5 Clipboard interface
|
// Current HTML5 Clipboard interface
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
|
@ -2060,10 +2060,18 @@ var onPaste = function ( event ) {
|
||||||
// rather than text/html; even from a webpage in Safari. The only way
|
// rather than text/html; even from a webpage in Safari. The only way
|
||||||
// to get an HTML version is to fallback to letting the browser insert
|
// to get an HTML version is to fallback to letting the browser insert
|
||||||
// the content. Same for getting image data. *Sigh*.
|
// the content. Same for getting image data. *Sigh*.
|
||||||
if ( clipboardData && (
|
//
|
||||||
indexOf.call( clipboardData.types, 'text/html' ) > -1 || (
|
// Firefox is even worse: it doesn't even let you know that there might be
|
||||||
indexOf.call( clipboardData.types, 'text/plain' ) > -1 &&
|
// an RTF version on the clipboard, but it will also convert to HTML if you
|
||||||
indexOf.call( clipboardData.types, 'text/rtf' ) < 0 ) ) ) {
|
// let the browser insert the content. I've filed
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1254028
|
||||||
|
types = clipboardData && clipboardData.types;
|
||||||
|
if ( types && (
|
||||||
|
indexOf.call( types, 'text/html' ) > -1 || (
|
||||||
|
!isGecko &&
|
||||||
|
indexOf.call( types, 'text/plain' ) > -1 &&
|
||||||
|
indexOf.call( types, 'text/rtf' ) < 0 )
|
||||||
|
)) {
|
||||||
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,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,7 +24,7 @@ var onPaste = function ( event ) {
|
||||||
hasImage = false,
|
hasImage = false,
|
||||||
plainItem = null,
|
plainItem = null,
|
||||||
self = this,
|
self = this,
|
||||||
l, item, type, data;
|
l, item, type, types, data;
|
||||||
|
|
||||||
// Current HTML5 Clipboard interface
|
// Current HTML5 Clipboard interface
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
|
@ -81,10 +81,18 @@ var onPaste = function ( event ) {
|
||||||
// rather than text/html; even from a webpage in Safari. The only way
|
// rather than text/html; even from a webpage in Safari. The only way
|
||||||
// to get an HTML version is to fallback to letting the browser insert
|
// to get an HTML version is to fallback to letting the browser insert
|
||||||
// the content. Same for getting image data. *Sigh*.
|
// the content. Same for getting image data. *Sigh*.
|
||||||
if ( clipboardData && (
|
//
|
||||||
indexOf.call( clipboardData.types, 'text/html' ) > -1 || (
|
// Firefox is even worse: it doesn't even let you know that there might be
|
||||||
indexOf.call( clipboardData.types, 'text/plain' ) > -1 &&
|
// an RTF version on the clipboard, but it will also convert to HTML if you
|
||||||
indexOf.call( clipboardData.types, 'text/rtf' ) < 0 ) ) ) {
|
// let the browser insert the content. I've filed
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1254028
|
||||||
|
types = clipboardData && clipboardData.types;
|
||||||
|
if ( types && (
|
||||||
|
indexOf.call( types, 'text/html' ) > -1 || (
|
||||||
|
!isGecko &&
|
||||||
|
indexOf.call( types, 'text/plain' ) > -1 &&
|
||||||
|
indexOf.call( types, 'text/rtf' ) < 0 )
|
||||||
|
)) {
|
||||||
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,
|
||||||
|
|
Loading…
Reference in a new issue