attaching images renders
This commit is contained in:
@@ -625,11 +625,18 @@ async function uploadAttachment(input) {
|
||||
throw new Error(err.detail || resp.statusText);
|
||||
}
|
||||
const data = await resp.json();
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user