Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix some images not loading

Abdullah Atta3876cb5ec3b2
diff --git a/packages/editor/src/extensions/image/component.tsx b/packages/editor/src/extensions/image/component.tsx
index 9ba8cb011..e221576e0 100644
--- a/packages/editor/src/extensions/image/component.tsx
+++ b/packages/editor/src/extensions/image/component.tsx
@@ -97,15 +97,12 @@ export function ImageComponent(
if (!inView) return;
if (src || !hash || bloburl) return;
(async function () {
- const { hash, filename, mime, size } = node.attrs;
- if (!!hash && !!filename && !!mime && !!size) {
+ const { hash } = node.attrs;
+ if (hash) {
const data = await editor.storage
.getAttachmentData?.({
type: "image",
- hash,
- filename,
- mime,
- size
+ hash
})
.catch(() => null);
if (typeof data !== "string" || !data) return; // TODO: show error
diff --git a/packages/editor/src/index.ts b/packages/editor/src/index.ts
index 7296d4c39..c35f4d30e 100644
--- a/packages/editor/src/index.ts
+++ b/packages/editor/src/index.ts
@@ -102,7 +102,9 @@ interface TiptapStorage {
attributes?: LinkAttributes
) => Promise<LinkAttributes | undefined>;
getAttachmentData:
- | ((attachment: Attachment) => Promise<string | undefined>)
+ | ((
+ attachment: Pick<Attachment, "hash" | "type">
+ ) => Promise<string | undefined>)
| undefined;
}