ui: fix monaco paste event

This commit is contained in:
undefined committed 2023-12-23 18:24:01 +08:00
1 parent 834925af21
commit d6669a6c5b
1 file changed
+3 -1
@@ -85,6 +85,8 @@ function handlePasteEvent(editor: monaco.editor.IStandaloneCodeEditor) {
ext = 'zip'; ext = 'zip';
} }
if (!ext) return; if (!ext) return;
ev.preventDefault();
ev.stopPropagation();
const filename = `${nanoid()}.${ext}`; const filename = `${nanoid()}.${ext}`;
const data = new FormData(); const data = new FormData();
data.append('filename', filename); data.append('filename', filename);
@@ -129,7 +131,7 @@ function handlePasteEvent(editor: monaco.editor.IStandaloneCodeEditor) {
console.error(e); console.error(e);
updateText(`${i18n('Upload Failed')}: ${e.message}`); updateText(`${i18n('Upload Failed')}: ${e.message}`);
}); });
}); }, { capture: true });
} }
export function registerAction( export function registerAction(