a tool for shared writing and social publishing

only skip paste if image in clipboard

+5 -5
+5 -5
components/Blocks/TextBlock/useHandlePaste.ts
··· 79 79 let xml = new DOMParser().parseFromString(textHTML, "text/html"); 80 80 let currentPosition = propsRef.current.position; 81 81 let children = flattenHTMLToTextBlocks(xml.body); 82 + let hasImage = false; 83 + for (let item of e.clipboardData.items) { 84 + if (item.type.includes("image")) hasImage = true; 85 + } 82 86 if ( 83 - !( 84 - children.length === 1 && 85 - children[0].tagName === "IMG" && 86 - e.clipboardData.items.length > 0 87 - ) 87 + !(children.length === 1 && children[0].tagName === "IMG" && hasImage) 88 88 ) { 89 89 children.forEach((child, index) => { 90 90 createBlockFromHTML(child, {