mirror of
https://github.com/fastmail/Squire.git
synced 2025-02-23 07:15:50 -05:00
parent
bf8f796ea4
commit
987f3afd52
3 changed files with 25 additions and 17 deletions
|
@ -3668,14 +3668,18 @@ proto.insertHTML = function ( html, isPaste ) {
|
|||
|
||||
proto.insertPlainText = function ( plainText, isPaste ) {
|
||||
var lines = plainText.split( '\n' ),
|
||||
i, l;
|
||||
for ( i = 1, l = lines.length - 1; i < l; i += 1 ) {
|
||||
lines[i] = '<DIV>' +
|
||||
lines[i].split( '&' ).join( '&' )
|
||||
i, l, line;
|
||||
for ( i = 0, l = lines.length; i < l; i += 1 ) {
|
||||
line = lines[i];
|
||||
line = line.split( '&' ).join( '&' )
|
||||
.split( '<' ).join( '<' )
|
||||
.split( '>' ).join( '>' )
|
||||
.replace( / (?= )/g, ' ' ) +
|
||||
'</DIV>';
|
||||
.replace( / (?= )/g, ' ' );
|
||||
// Wrap all but first/last lines in <div></div>
|
||||
if ( i && i + 1 < l ) {
|
||||
line = '<DIV>' + ( line || '<BR>' ) + '</DIV>';
|
||||
}
|
||||
lines[i] = line;
|
||||
}
|
||||
return this.insertHTML( lines.join( '' ), isPaste );
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1536,14 +1536,18 @@ proto.insertHTML = function ( html, isPaste ) {
|
|||
|
||||
proto.insertPlainText = function ( plainText, isPaste ) {
|
||||
var lines = plainText.split( '\n' ),
|
||||
i, l;
|
||||
for ( i = 1, l = lines.length - 1; i < l; i += 1 ) {
|
||||
lines[i] = '<DIV>' +
|
||||
lines[i].split( '&' ).join( '&' )
|
||||
i, l, line;
|
||||
for ( i = 0, l = lines.length; i < l; i += 1 ) {
|
||||
line = lines[i];
|
||||
line = line.split( '&' ).join( '&' )
|
||||
.split( '<' ).join( '<' )
|
||||
.split( '>' ).join( '>' )
|
||||
.replace( / (?= )/g, ' ' ) +
|
||||
'</DIV>';
|
||||
.replace( / (?= )/g, ' ' );
|
||||
// Wrap all but first/last lines in <div></div>
|
||||
if ( i && i + 1 < l ) {
|
||||
line = '<DIV>' + ( line || '<BR>' ) + '</DIV>';
|
||||
}
|
||||
lines[i] = line;
|
||||
}
|
||||
return this.insertHTML( lines.join( '' ), isPaste );
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue