From 7208d14833503fb770d38f4b415994a4272c6e48 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 2 Jul 2025 14:01:52 -0700 Subject: [PATCH] fix: pasting images --- .../TipTapEditor/utils/editorConfig.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts b/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts index be1c61dd7..0cbb1e818 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts @@ -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); + }, + ); } } },