fix: pasting images

This commit is contained in:
Patrick Erichsen 2025-07-02 14:01:52 -07:00
parent b209bce952
commit 7208d14833

View file

@ -155,22 +155,24 @@ export function createEditorConfig(options: {
for (const item of items) {
const file = item.getAsFile();
file &&
void modelSupportsImages(
modelSupportsImages(
model.provider,
model.model,
model.title,
model.capabilities,
) &&
handleImageFile(ideMessenger, file).then((resp) => {
if (!resp) return;
const [img, dataUrl] = resp;
const { schema } = view.state;
const node = schema.nodes.image.create({
src: dataUrl,
});
const tr = view.state.tr.insert(0, node);
view.dispatch(tr);
});
void handleImageFile(ideMessenger, file).then(
(resp) => {
if (!resp) return;
const [img, dataUrl] = resp;
const { schema } = view.state;
const node = schema.nodes.image.create({
src: dataUrl,
});
const tr = view.state.tr.insert(0, node);
view.dispatch(tr);
},
);
}
}
},