mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
Fix first line of plain text paste not HTML escaped
This commit is contained in:
parent
f6d6ac8ca0
commit
2d307ba54a
3 changed files with 15 additions and 9 deletions
|
@ -4579,13 +4579,16 @@ proto.insertPlainText = function ( plainText, isPaste ) {
|
|||
}
|
||||
openBlock += '>';
|
||||
|
||||
// We don't wrap the first line in the block, so if it gets inserted into
|
||||
// a blank line it keeps that line's formatting.
|
||||
for ( i = 1, l = lines.length; i < l; i += 1 ) {
|
||||
for ( i = 0, l = lines.length; i < l; i += 1 ) {
|
||||
line = lines[i];
|
||||
line = escapeHTML( line ).replace( / (?= )/g, ' ' );
|
||||
// We don't wrap the first line in the block, so if it gets inserted
|
||||
// into a blank line it keeps that line's formatting.
|
||||
// Wrap each line in <div></div>
|
||||
lines[i] = openBlock + ( line || '<BR>' ) + closeBlock;
|
||||
if ( i ) {
|
||||
line = openBlock + ( line || '<BR>' ) + closeBlock;
|
||||
}
|
||||
lines[i] = line;
|
||||
}
|
||||
return this.insertHTML( lines.join( '' ), isPaste );
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2020,13 +2020,16 @@ proto.insertPlainText = function ( plainText, isPaste ) {
|
|||
}
|
||||
openBlock += '>';
|
||||
|
||||
// We don't wrap the first line in the block, so if it gets inserted into
|
||||
// a blank line it keeps that line's formatting.
|
||||
for ( i = 1, l = lines.length; i < l; i += 1 ) {
|
||||
for ( i = 0, l = lines.length; i < l; i += 1 ) {
|
||||
line = lines[i];
|
||||
line = escapeHTML( line ).replace( / (?= )/g, ' ' );
|
||||
// We don't wrap the first line in the block, so if it gets inserted
|
||||
// into a blank line it keeps that line's formatting.
|
||||
// Wrap each line in <div></div>
|
||||
lines[i] = openBlock + ( line || '<BR>' ) + closeBlock;
|
||||
if ( i ) {
|
||||
line = openBlock + ( line || '<BR>' ) + closeBlock;
|
||||
}
|
||||
lines[i] = line;
|
||||
}
|
||||
return this.insertHTML( lines.join( '' ), isPaste );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue