0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

allow leading tabs when pasting

This commit is contained in:
Limon Monte 2021-10-10 21:15:25 +03:00 committed by Neil Jenkins
parent 8ff042dd22
commit c045ec0df5
2 changed files with 4 additions and 3 deletions

View file

@ -238,7 +238,7 @@ var cleanTree = function cleanTree ( node, config, preserveWS ) {
break;
}
}
data = data.replace( /^[ \t\r\n]+/g, sibling ? ' ' : '' );
data = data.replace( /^[ \r\n]+/g, sibling ? ' ' : '' );
}
if ( endsWithWS ) {
walker.currentNode = child;
@ -253,7 +253,7 @@ var cleanTree = function cleanTree ( node, config, preserveWS ) {
break;
}
}
data = data.replace( /[ \t\r\n]+$/g, sibling ? ' ' : '' );
data = data.replace( /[ \r\n]+$/g, sibling ? ' ' : '' );
}
if ( data ) {
child.data = data;

View file

@ -120,7 +120,8 @@ var sanitizeToDOMFragment = function ( html, isPaste, self ) {
ALLOW_UNKNOWN_PROTOCOLS: true,
WHOLE_DOCUMENT: false,
RETURN_DOM: true,
RETURN_DOM_FRAGMENT: true
RETURN_DOM_FRAGMENT: true,
FORCE_BODY: false
}) : null;
return frag ? doc.importNode( frag, true ) : doc.createDocumentFragment();
};