Skip to content

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

web: use bloburl when previewing images

Abdullah Attaa101dbdf316b
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx
index b8a656582..42615a451 100644
--- a/apps/web/src/components/editor/index.tsx
+++ b/apps/web/src/components/editor/index.tsx
@@ -430,13 +430,15 @@ export function Editor(props: EditorProps) {
onContentChange={onContentChange}
onChange={onEditorChange}
onDownloadAttachment={(attachment) => saveAttachment(attachment.hash)}
- onPreviewAttachment={async ({ hash, dataurl }) => {
+ onPreviewAttachment={async (data) => {
+ const { hash } = data;
const attachment = db.attachments?.attachment(hash);
if (attachment && attachment.metadata.type.startsWith("image/")) {
const container = document.getElementById("dialogContainer");
if (!(container instanceof HTMLElement)) return;
- dataurl = dataurl || (await downloadAttachment(hash, "base64"));
+ const dataurl =
+ data.bloburl || (await downloadAttachment(hash, "base64"));
if (!dataurl)
return showToast("error", "This image cannot be previewed.");
diff --git a/apps/web/src/components/editor/picker.ts b/apps/web/src/components/editor/picker.ts
index c7a32ebe4..d209adb71 100644
--- a/apps/web/src/components/editor/picker.ts
+++ b/apps/web/src/components/editor/picker.ts
@@ -137,6 +137,7 @@ export type Attachment = {
mime: string;
size: number;
dataurl?: string;
+ bloburl?: string;
};
type AddAttachmentOptions = {