tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
don't paste empty text nodes
awarm.space
8 months ago
4cedda12
86ee3171
+5
-3
1 changed file
expand all
collapse all
unified
split
components
Blocks
TextBlock
useHandlePaste.ts
+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
494
-
let newElement = document.createElement("p");
495
495
-
newElement.textContent = node.textContent;
496
496
-
htmlBlocks.push(newElement);
494
494
+
if (node.textContent && node.textContent.trim() !== "") {
495
495
+
let newElement = document.createElement("p");
496
496
+
newElement.textContent = node.textContent;
497
497
+
htmlBlocks.push(newElement);
498
498
+
}
497
499
}
498
500
if (node.nodeType === Node.ELEMENT_NODE) {
499
501
const elementNode = node as HTMLElement;