0
Fork 0
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:
Frank Hellenkamp 2017-04-10 18:38:05 +02:00
parent bb593e879a
commit 6da018a85b
3 changed files with 16 additions and 2 deletions

View file

@ -2258,6 +2258,13 @@ var onCopy = function ( event ) {
contents = newContents;
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
node = this.createElement( 'div' );
node.appendChild( contents );

File diff suppressed because one or more lines are too long

View file

@ -121,6 +121,13 @@ var onCopy = function ( event ) {
contents = newContents;
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
node = this.createElement( 'div' );
node.appendChild( contents );