diff --git a/source/Editor.ts b/source/Editor.ts index a5a57a80..f2ddda76 100644 --- a/source/Editor.ts +++ b/source/Editor.ts @@ -2122,7 +2122,7 @@ class Squire { break; } - if (!(child as HTMLElement).isContentEditable) { + if (child && !(child as HTMLElement).isContentEditable) { replaceWith(child, document.createTextNode('') as Text); break; } diff --git a/source/node/Node.ts b/source/node/Node.ts index 0a0b1757..6acfd84f 100644 --- a/source/node/Node.ts +++ b/source/node/Node.ts @@ -42,7 +42,8 @@ const areAlike = ( return ( node.nodeName !== 'A' && node.className === node2.className && - node.style.cssText === node2.style.cssText + node.style.cssText === node2.style.cssText && + (node as HTMLElement).isContentEditable && (node2 as HTMLElement).isContentEditable ); } return true;