a tool for shared writing and social publishing

don't paste empty text nodes

+5 -3
+5 -3
components/Blocks/TextBlock/useHandlePaste.ts
··· 491 491 // Function to recursively collect HTML from nodes 492 492 function collectHTML(node: Node, htmlBlocks: HTMLElement[]): void { 493 493 if (node.nodeType === Node.TEXT_NODE) { 494 - let newElement = document.createElement("p"); 495 - newElement.textContent = node.textContent; 496 - htmlBlocks.push(newElement); 494 + if (node.textContent && node.textContent.trim() !== "") { 495 + let newElement = document.createElement("p"); 496 + newElement.textContent = node.textContent; 497 + htmlBlocks.push(newElement); 498 + } 497 499 } 498 500 if (node.nodeType === Node.ELEMENT_NODE) { 499 501 const elementNode = node as HTMLElement;