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
only skip paste if image in clipboard
awarm.space
8 months ago
ee06099b
c03b6294
+5
-5
1 changed file
expand all
collapse all
unified
split
components
Blocks
TextBlock
useHandlePaste.ts
+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
82
+
let hasImage = false;
83
83
+
for (let item of e.clipboardData.items) {
84
84
+
if (item.type.includes("image")) hasImage = true;
85
85
+
}
82
86
if (
83
83
-
!(
84
84
-
children.length === 1 &&
85
85
-
children[0].tagName === "IMG" &&
86
86
-
e.clipboardData.items.length > 0
87
87
-
)
87
87
+
!(children.length === 1 && children[0].tagName === "IMG" && hasImage)
88
88
) {
89
89
children.forEach((child, index) => {
90
90
createBlockFromHTML(child, {