From 28c4854985dc49fa6c7da58f14bc06194e4212f7 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 6 Mar 2023 20:30:29 -0500 Subject: [PATCH] fix: More strict handling of paste board images --- shared/editor/nodes/Image.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/shared/editor/nodes/Image.tsx b/shared/editor/nodes/Image.tsx index 6bdc563af..1db0e5397 100644 --- a/shared/editor/nodes/Image.tsx +++ b/shared/editor/nodes/Image.tsx @@ -63,12 +63,11 @@ const uploadPlugin = (options: Options) => // an image version of the content, check if there is also text and // use that instead in this scenario. const html = event.clipboardData.getData("text/html"); - const text = event.clipboardData.getData("text/plain"); - const isMicrosoftOffice = html.includes( - "urn:schemas-microsoft-com:office" - ); - if (text.length && isMicrosoftOffice) { - // Fallback to default paste behavior + + // Fallback to default paste behavior if the clipboard contains HTML + // Even if there is an image, it's likely to be a screenshot from eg + // Microsoft Suite / Apple Numbers – and not the original content. + if (html.length && !html.includes("