mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
Workaround iOS clipboardData bug
This commit is contained in:
parent
6a348e084b
commit
3be9a7dea8
3 changed files with 13 additions and 5 deletions
|
@ -2012,7 +2012,9 @@ var onCut = function ( event ) {
|
||||||
this.saveUndoState( range );
|
this.saveUndoState( range );
|
||||||
|
|
||||||
// Edge only seems to support setting plain text as of 2016-03-11.
|
// Edge only seems to support setting plain text as of 2016-03-11.
|
||||||
if ( !isEdge && clipboardData ) {
|
// Mobile Safari flat out doesn't work:
|
||||||
|
// https://bugs.webkit.org/show_bug.cgi?id=143776
|
||||||
|
if ( !isEdge && !isIOS && clipboardData ) {
|
||||||
moveRangeBoundariesUpTree( range, root );
|
moveRangeBoundariesUpTree( range, root );
|
||||||
node.appendChild( deleteContentsOfRange( range, root ) );
|
node.appendChild( deleteContentsOfRange( range, root ) );
|
||||||
clipboardData.setData( 'text/html', node.innerHTML );
|
clipboardData.setData( 'text/html', node.innerHTML );
|
||||||
|
@ -2039,7 +2041,9 @@ var onCopy = function ( event ) {
|
||||||
var node = this.createElement( 'div' );
|
var node = this.createElement( 'div' );
|
||||||
|
|
||||||
// Edge only seems to support setting plain text as of 2016-03-11.
|
// Edge only seems to support setting plain text as of 2016-03-11.
|
||||||
if ( !isEdge && clipboardData ) {
|
// Mobile Safari flat out doesn't work:
|
||||||
|
// https://bugs.webkit.org/show_bug.cgi?id=143776
|
||||||
|
if ( !isEdge && !isIOS && clipboardData ) {
|
||||||
node.appendChild( range.cloneContents() );
|
node.appendChild( range.cloneContents() );
|
||||||
clipboardData.setData( 'text/html', node.innerHTML );
|
clipboardData.setData( 'text/html', node.innerHTML );
|
||||||
clipboardData.setData( 'text/plain',
|
clipboardData.setData( 'text/plain',
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,9 @@ var onCut = function ( event ) {
|
||||||
this.saveUndoState( range );
|
this.saveUndoState( range );
|
||||||
|
|
||||||
// Edge only seems to support setting plain text as of 2016-03-11.
|
// Edge only seems to support setting plain text as of 2016-03-11.
|
||||||
if ( !isEdge && clipboardData ) {
|
// Mobile Safari flat out doesn't work:
|
||||||
|
// https://bugs.webkit.org/show_bug.cgi?id=143776
|
||||||
|
if ( !isEdge && !isIOS && clipboardData ) {
|
||||||
moveRangeBoundariesUpTree( range, root );
|
moveRangeBoundariesUpTree( range, root );
|
||||||
node.appendChild( deleteContentsOfRange( range, root ) );
|
node.appendChild( deleteContentsOfRange( range, root ) );
|
||||||
clipboardData.setData( 'text/html', node.innerHTML );
|
clipboardData.setData( 'text/html', node.innerHTML );
|
||||||
|
@ -38,7 +40,9 @@ var onCopy = function ( event ) {
|
||||||
var node = this.createElement( 'div' );
|
var node = this.createElement( 'div' );
|
||||||
|
|
||||||
// Edge only seems to support setting plain text as of 2016-03-11.
|
// Edge only seems to support setting plain text as of 2016-03-11.
|
||||||
if ( !isEdge && clipboardData ) {
|
// Mobile Safari flat out doesn't work:
|
||||||
|
// https://bugs.webkit.org/show_bug.cgi?id=143776
|
||||||
|
if ( !isEdge && !isIOS && clipboardData ) {
|
||||||
node.appendChild( range.cloneContents() );
|
node.appendChild( range.cloneContents() );
|
||||||
clipboardData.setData( 'text/html', node.innerHTML );
|
clipboardData.setData( 'text/html', node.innerHTML );
|
||||||
clipboardData.setData( 'text/plain',
|
clipboardData.setData( 'text/plain',
|
||||||
|
|
Loading…
Reference in a new issue