From e4e12bdaa97325e832c3c8f88b642c50f3b7b992 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Thu, 16 Feb 2023 14:45:12 +0100 Subject: [PATCH] Cleanup fix for #962 --- vendors/squire/build/squire-raw.js | 36 ++---------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/vendors/squire/build/squire-raw.js b/vendors/squire/build/squire-raw.js index 97a16a840..2dafbc496 100644 --- a/vendors/squire/build/squire-raw.js +++ b/vendors/squire/build/squire-raw.js @@ -280,39 +280,7 @@ const // Recursively examine container nodes and wrap any inline children. fixContainer = ( container, root ) => { -/* - // Live, but very slow - let children = container.childNodes; - let wrapper = null; - let i = 0, l = children.length, child, isBR; - - for ( ; i < l; ++i ) { - child = children[i]; - isBR = child.nodeName === 'BR'; - if ( !isBR && isInline( child ) -// && (root.__squire__._config.blockTag !== 'DIV' || (child.matches && !child.matches(phrasingElements))) - ) { - wrapper = wrapper || createElement( 'div' ); - wrapper.append( child ); - --i; - --l; - } else if ( isBR || wrapper ) { - wrapper = wrapper || createElement( 'div' ); - fixCursor( wrapper, root ); - if ( isBR ) { - child.replaceWith( wrapper ); - } else { - child.before( wrapper ); - ++i; - ++l; - } - wrapper = null; - } - isContainer( child ) && fixContainer( child, root ); - } -*/ let wrapper, isBR; - // Not live, and fast [...container.children].forEach(child => { isBR = child.nodeName === 'BR'; if ( !isBR && isInline( child ) @@ -323,10 +291,10 @@ const } else if ( isBR || wrapper ) { wrapper = wrapper || createElement( 'div' ); fixCursor( wrapper, root ); - isBR ? child.replaceWith( wrapper ) : child.before( wrapper ); + child[isBR ? 'replaceWith' : 'before']( wrapper ); wrapper = null; } - isContainer( child ) && fixContainer( child, root ); + isContainer( child ) && fixContainer( child, root ); }); wrapper && container.append( fixCursor( wrapper, root ) ); return container;