mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
updated onCopy function to remove unnessecary brs from html
This commit is contained in:
parent
bb593e879a
commit
6da018a85b
3 changed files with 16 additions and 2 deletions
|
@ -2258,6 +2258,13 @@ var onCopy = function ( event ) {
|
||||||
contents = newContents;
|
contents = newContents;
|
||||||
parent = parent.parentNode;
|
parent = parent.parentNode;
|
||||||
}
|
}
|
||||||
|
// remove br's that are the last children in a node
|
||||||
|
var brs = contents.querySelectorAll('br');
|
||||||
|
brs.forEach(function(br) {
|
||||||
|
if (br.nextSibling === null) {
|
||||||
|
br.parentNode.removeChild(br);
|
||||||
|
}
|
||||||
|
});
|
||||||
// Set clipboard data
|
// Set clipboard data
|
||||||
node = this.createElement( 'div' );
|
node = this.createElement( 'div' );
|
||||||
node.appendChild( contents );
|
node.appendChild( contents );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -121,6 +121,13 @@ var onCopy = function ( event ) {
|
||||||
contents = newContents;
|
contents = newContents;
|
||||||
parent = parent.parentNode;
|
parent = parent.parentNode;
|
||||||
}
|
}
|
||||||
|
// remove br's that are the last children in a node
|
||||||
|
var brs = contents.querySelectorAll('br');
|
||||||
|
brs.forEach(function(br) {
|
||||||
|
if (br.nextSibling === null) {
|
||||||
|
br.parentNode.removeChild(br);
|
||||||
|
}
|
||||||
|
});
|
||||||
// Set clipboard data
|
// Set clipboard data
|
||||||
node = this.createElement( 'div' );
|
node = this.createElement( 'div' );
|
||||||
node.appendChild( contents );
|
node.appendChild( contents );
|
||||||
|
|
Loading…
Reference in a new issue