a tool for shared writing and social publishing
0
fork

Configure Feed

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

fixed issue where paste breaks if clipboard html contained a span

celine fa1aca31 1dac8e6e

+10 -2
+10 -2
components/Blocks/TextBlock/useHandlePaste.ts
··· 45 45 }); 46 46 return true; 47 47 } 48 + // if there is no html, but there is text, convert the text to markdown 48 49 if (!textHTML && text) { 49 50 textHTML = markdownToHtml(text); 50 51 } 52 + // if thre is html 51 53 if (textHTML) { 52 54 let xml = new DOMParser().parseFromString(textHTML, "text/html"); 53 55 let currentPosition = propsRef.current.position; 54 56 let children = flattenHTMLToTextBlocks(xml.body); 55 57 if ( 56 58 children.find((c) => 57 - ["P", "H1", "H2", "H3", "UL", "DIV", "IMG"].includes(c.tagName), 59 + ["P", "H1", "H2", "H3", "UL", "DIV", "SPAN", "IMG"].includes( 60 + c.tagName, 61 + ), 58 62 ) && 59 63 !(children.length === 1 && children[0].tagName === "IMG") 60 64 ) { ··· 169 173 } 170 174 switch (child.tagName) { 171 175 case "LI": 172 - case "SPAN": 176 + case "SPAN": { 177 + type = "text"; 178 + break; 179 + } 173 180 case "P": { 174 181 type = "text"; 175 182 break; ··· 403 410 "UL", 404 411 "IMG", 405 412 "A", 413 + "SPAN", 406 414 ].includes(elementNode.tagName) || 407 415 elementNode.getAttribute("data-entityID") 408 416 ) {