mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Only cleanupBrs on copy if using innerText
This is a fix for Firefox's inner text handling, so if we're not using that don't bother.
This commit is contained in:
parent
a91c3f3042
commit
e46b2e4881
3 changed files with 9 additions and 9 deletions
|
@ -2233,10 +2233,6 @@ var setClipboardData =
|
||||||
var html, text;
|
var html, text;
|
||||||
|
|
||||||
node.appendChild( contents );
|
node.appendChild( contents );
|
||||||
// Firefox will add an extra new line for BRs at the end of block when
|
|
||||||
// calculating innerText, even though they don't actually affect display.
|
|
||||||
// So we need to remove them first.
|
|
||||||
cleanupBRs( node, root, true );
|
|
||||||
|
|
||||||
html = node.innerHTML;
|
html = node.innerHTML;
|
||||||
if ( willCutCopy ) {
|
if ( willCutCopy ) {
|
||||||
|
@ -2246,6 +2242,10 @@ var setClipboardData =
|
||||||
if ( toPlainText ) {
|
if ( toPlainText ) {
|
||||||
text = toPlainText( html );
|
text = toPlainText( html );
|
||||||
} else {
|
} else {
|
||||||
|
// Firefox will add an extra new line for BRs at the end of block when
|
||||||
|
// calculating innerText, even though they don't actually affect
|
||||||
|
// display, so we need to remove them first.
|
||||||
|
cleanupBRs( node, root, true );
|
||||||
node.setAttribute( 'style',
|
node.setAttribute( 'style',
|
||||||
'position:fixed;overflow:hidden;bottom:100%;right:100%;' );
|
'position:fixed;overflow:hidden;bottom:100%;right:100%;' );
|
||||||
body.appendChild( node );
|
body.appendChild( node );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,10 +12,6 @@ var setClipboardData =
|
||||||
var html, text;
|
var html, text;
|
||||||
|
|
||||||
node.appendChild( contents );
|
node.appendChild( contents );
|
||||||
// Firefox will add an extra new line for BRs at the end of block when
|
|
||||||
// calculating innerText, even though they don't actually affect display.
|
|
||||||
// So we need to remove them first.
|
|
||||||
cleanupBRs( node, root, true );
|
|
||||||
|
|
||||||
html = node.innerHTML;
|
html = node.innerHTML;
|
||||||
if ( willCutCopy ) {
|
if ( willCutCopy ) {
|
||||||
|
@ -25,6 +21,10 @@ var setClipboardData =
|
||||||
if ( toPlainText ) {
|
if ( toPlainText ) {
|
||||||
text = toPlainText( html );
|
text = toPlainText( html );
|
||||||
} else {
|
} else {
|
||||||
|
// Firefox will add an extra new line for BRs at the end of block when
|
||||||
|
// calculating innerText, even though they don't actually affect
|
||||||
|
// display, so we need to remove them first.
|
||||||
|
cleanupBRs( node, root, true );
|
||||||
node.setAttribute( 'style',
|
node.setAttribute( 'style',
|
||||||
'position:fixed;overflow:hidden;bottom:100%;right:100%;' );
|
'position:fixed;overflow:hidden;bottom:100%;right:100%;' );
|
||||||
body.appendChild( node );
|
body.appendChild( node );
|
||||||
|
|
Loading…
Reference in a new issue