Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: show content image (#602)

boojackce795a2a7d20
diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx
index a604d1e39..e24ec9fd0 100644
--- a/web/src/components/Memo.tsx
+++ b/web/src/components/Memo.tsx
@@ -139,24 +139,9 @@ const Memo: React.FC<Props> = (props: Props) => {
}
}
} else if (targetEl.tagName === "IMG") {
- const currImgUrl = targetEl.getAttribute("src");
-
- if (currImgUrl) {
- // use regex to get all image urls from memo content
- const imageUrls =
- memo.content.match(/!\[.*?\]\((.*?)\)/g)?.map(
- (item) =>
- `/o/get/image?url=${
- item
- .match(/\((.*?)\)/g)
- ?.slice(-1)[0]
- .slice(1, -1) ?? ""
- }`
- ) ?? [];
- showPreviewImageDialog(
- imageUrls,
- imageUrls.findIndex((item) => item === currImgUrl)
- );
+ const imgUrl = targetEl.getAttribute("src");
+ if (imgUrl) {
+ showPreviewImageDialog([imgUrl], 0);
}
}
};