{
if (imageFiles(event.dataTransfer).length > 0) {
event.preventDefault();
}
}}
ondrop={(event) => {
const files = imageFiles(event.dataTransfer);
if (files.length === 0 || !onInsertImage) {
return;
}
event.preventDefault();
void (async () => {
for (const file of files) {
const snippet = await onInsertImage(file);
const rel = snippet ? /\(([^)]+)\)/.exec(snippet)?.[1] : null;
if (!rel || !editor) {
continue;
}
try {
const src = await workspaceReadDataUrl(rel);
editor.commands.insertContent(
`

`,
);
} catch {
editor.commands.insertContent(snippet);
}
}
})();
}}
>
{#if menu}