From ee06099bea942549430928ea6f7d4d50f820172e Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Fri, 11 Jul 2025 00:08:28 -0400 Subject: [PATCH] only skip paste if image in clipboard --- components/Blocks/TextBlock/useHandlePaste.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/Blocks/TextBlock/useHandlePaste.ts b/components/Blocks/TextBlock/useHandlePaste.ts index 3ec1a145..4055c18e 100644 --- a/components/Blocks/TextBlock/useHandlePaste.ts +++ b/components/Blocks/TextBlock/useHandlePaste.ts @@ -79,12 +79,12 @@ export const useHandlePaste = ( let xml = new DOMParser().parseFromString(textHTML, "text/html"); let currentPosition = propsRef.current.position; let children = flattenHTMLToTextBlocks(xml.body); + let hasImage = false; + for (let item of e.clipboardData.items) { + if (item.type.includes("image")) hasImage = true; + } if ( - !( - children.length === 1 && - children[0].tagName === "IMG" && - e.clipboardData.items.length > 0 - ) + !(children.length === 1 && children[0].tagName === "IMG" && hasImage) ) { children.forEach((child, index) => { createBlockFromHTML(child, { -- 2.51.2