fix: paste not working anywhere in the editor

(fixes streetwriters/notesnook#740)
This commit is contained in:
thecodrr
2022-07-26 11:59:28 +05:00
parent 88d5d22576
commit 2b097bb3b6

View File

@@ -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);
}
}