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

Fix prefix white-space trimmed on paste of plain text.

This commit is contained in:
Neil Jenkins 2015-07-25 18:11:56 -07:00
parent c190fab9fd
commit 900e43cca8
3 changed files with 5 additions and 11 deletions

View file

@ -1832,11 +1832,8 @@ var cleanTree = function cleanTree ( node ) {
} else {
if ( nodeType === TEXT_NODE ) {
data = child.data;
// Use \s instead of notWS, because we want to remove nodes
// which are just nbsp, in order to cleanup <div>nbsp<br></div>
// construct.
startsWithWS = /\s/.test( data.charAt( 0 ) );
endsWithWS = /\s/.test( data.charAt( data.length - 1 ) );
startsWithWS = !notWS.test( data.charAt( 0 ) );
endsWithWS = !notWS.test( data.charAt( data.length - 1 ) );
if ( !startsWithWS && !endsWithWS ) {
continue;
}

File diff suppressed because one or more lines are too long

View file

@ -215,11 +215,8 @@ var cleanTree = function cleanTree ( node ) {
} else {
if ( nodeType === TEXT_NODE ) {
data = child.data;
// Use \s instead of notWS, because we want to remove nodes
// which are just nbsp, in order to cleanup <div>nbsp<br></div>
// construct.
startsWithWS = /\s/.test( data.charAt( 0 ) );
endsWithWS = /\s/.test( data.charAt( data.length - 1 ) );
startsWithWS = !notWS.test( data.charAt( 0 ) );
endsWithWS = !notWS.test( data.charAt( data.length - 1 ) );
if ( !startsWithWS && !endsWithWS ) {
continue;
}