a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

collect textnodes properly on paste

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