0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Fix typo and whitespace issues

This commit is contained in:
Neil Jenkins 2020-03-02 10:21:23 +11:00
parent c5a7c622fe
commit ede1991931

View file

@ -1965,11 +1965,11 @@ proto.insertHTML = function ( html, isPaste ) {
return this; return this;
}; };
var escapeHTMLFragement = function ( text ) { var escapeHTML = function ( text ) {
return text.split( '&' ).join( '&' ) return text.split( '&' ).join( '&' )
.split( '<' ).join( '&lt;' ) .split( '<' ).join( '&lt;' )
.split( '>' ).join( '&gt;' ) .split( '>' ).join( '&gt;' )
.split( '"' ).join( '&quot;' ); .split( '"' ).join( '&quot;' );
}; };
proto.insertPlainText = function ( plainText, isPaste ) { proto.insertPlainText = function ( plainText, isPaste ) {
@ -2015,14 +2015,14 @@ proto.insertPlainText = function ( plainText, isPaste ) {
for ( attr in attributes ) { for ( attr in attributes ) {
openBlock += ' ' + attr + '="' + openBlock += ' ' + attr + '="' +
escapeHTMLFragement( attributes[ attr ] ) + escapeHTML( attributes[ attr ] ) +
'"'; '"';
} }
openBlock += '>'; openBlock += '>';
for ( i = 0, l = lines.length; i < l; i += 1 ) { for ( i = 0, l = lines.length; i < l; i += 1 ) {
line = lines[i]; line = lines[i];
line = escapeHTMLFragement( line ).replace( / (?= )/g, '&nbsp;' ); line = escapeHTML( line ).replace( / (?= )/g, '&nbsp;' );
// Wrap each line in <div></div> // Wrap each line in <div></div>
lines[i] = openBlock + ( line || '<BR>' ) + closeBlock; lines[i] = openBlock + ( line || '<BR>' ) + closeBlock;
} }