From 2b097bb3b683830160062dd2cbeca9fb94ca6502 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Tue, 26 Jul 2022 11:59:28 +0500 Subject: [PATCH] fix: paste not working anywhere in the editor (fixes streetwriters/notesnook#740) --- apps/web/src/components/editor/index.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx index b50303659..b4068ee8b 100644 --- a/apps/web/src/components/editor/index.tsx +++ b/apps/web/src/components/editor/index.tsx @@ -132,14 +132,12 @@ export default function EditorManager({ onPaste={async (event) => { if (!editor) return; - if (event.clipboardData?.items?.length) { + if (event.clipboardData?.files?.length) { event.preventDefault(); - - for (let item of event.clipboardData.items) { - const file = item.getAsFile(); - if (!file) continue; + for (let file of event.clipboardData.files) { const result = await attachFile(file); if (!result) continue; + editor.attachFile(result); } }