From c2436f39eabcdcd4c651a098eea5348b7527a242 Mon Sep 17 00:00:00 2001 From: schmeeve Date: Wed, 23 Sep 2026 16:54:20 -0700 Subject: [PATCH] attaching images renders --- static/app.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/static/app.js b/static/app.js index bd89a33..d137337 100644 --- a/static/app.js +++ b/static/app.js @@ -625,11 +625,18 @@ async function uploadAttachment(input) { throw new Error(err.detail || resp.statusText); } const data = await resp.json(); - state.editor.chain().focus().insertContent({ - type: "text", - text: data.name, - marks: [{ type: "link", attrs: { href: data.url } }], - }).run(); + if (file.type.startsWith("image/")) { + state.editor.chain().focus().insertContent({ + type: "image", + attrs: { src: data.url, alt: data.name, title: data.name }, + }).run(); + } else { + state.editor.chain().focus().insertContent({ + type: "text", + text: data.name, + marks: [{ type: "link", attrs: { href: data.url } }], + }).run(); + } if (status) status.textContent = "Attached " + data.name; } catch (e) { if (status) status.textContent = "Error: " + e.message;