From c045ec0df551a333b9565d8738d13e8157fd4301 Mon Sep 17 00:00:00 2001 From: Limon Monte Date: Sun, 10 Oct 2021 21:15:25 +0300 Subject: [PATCH] allow leading tabs when pasting --- source/Clean.js | 4 ++-- source/Editor.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/Clean.js b/source/Clean.js index 326e8e7..8c1f086 100644 --- a/source/Clean.js +++ b/source/Clean.js @@ -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; diff --git a/source/Editor.js b/source/Editor.js index f024e79..4ee294c 100644 --- a/source/Editor.js +++ b/source/Editor.js @@ -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(); };