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:
parent
c190fab9fd
commit
900e43cca8
3 changed files with 5 additions and 11 deletions
|
@ -1832,11 +1832,8 @@ var cleanTree = function cleanTree ( node ) {
|
||||||
} else {
|
} else {
|
||||||
if ( nodeType === TEXT_NODE ) {
|
if ( nodeType === TEXT_NODE ) {
|
||||||
data = child.data;
|
data = child.data;
|
||||||
// Use \s instead of notWS, because we want to remove nodes
|
startsWithWS = !notWS.test( data.charAt( 0 ) );
|
||||||
// which are just nbsp, in order to cleanup <div>nbsp<br></div>
|
endsWithWS = !notWS.test( data.charAt( data.length - 1 ) );
|
||||||
// construct.
|
|
||||||
startsWithWS = /\s/.test( data.charAt( 0 ) );
|
|
||||||
endsWithWS = /\s/.test( data.charAt( data.length - 1 ) );
|
|
||||||
if ( !startsWithWS && !endsWithWS ) {
|
if ( !startsWithWS && !endsWithWS ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -215,11 +215,8 @@ var cleanTree = function cleanTree ( node ) {
|
||||||
} else {
|
} else {
|
||||||
if ( nodeType === TEXT_NODE ) {
|
if ( nodeType === TEXT_NODE ) {
|
||||||
data = child.data;
|
data = child.data;
|
||||||
// Use \s instead of notWS, because we want to remove nodes
|
startsWithWS = !notWS.test( data.charAt( 0 ) );
|
||||||
// which are just nbsp, in order to cleanup <div>nbsp<br></div>
|
endsWithWS = !notWS.test( data.charAt( data.length - 1 ) );
|
||||||
// construct.
|
|
||||||
startsWithWS = /\s/.test( data.charAt( 0 ) );
|
|
||||||
endsWithWS = /\s/.test( data.charAt( data.length - 1 ) );
|
|
||||||
if ( !startsWithWS && !endsWithWS ) {
|
if ( !startsWithWS && !endsWithWS ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue