Unverified Commit 8cc0977a authored by Zeng1998's avatar Zeng1998 Committed by GitHub

fix: image url extraction (#453)

fix: image-url-extraction
Co-authored-by: 's avatarboojack <stevenlgtm@gmail.com>
parent 0809ec8c
......@@ -165,7 +165,14 @@ const Memo: React.FC<Props> = (props: Props) => {
if (currImgUrl) {
// use regex to get all image urls from memo content
const imageUrls = memo.content.match(/!\[.*?\]\((.*?)\)/g)?.map((item) => item.match(/\((.*?)\)/)?.[1] ?? "") ?? [];
const imageUrls =
memo.content.match(/!\[.*?\]\((.*?)\)/g)?.map(
(item) =>
item
.match(/\((.*?)\)/g)
?.slice(-1)[0]
.slice(1, -1) ?? ""
) ?? [];
showPreviewImageDialog(
imageUrls,
imageUrls.findIndex((item) => item === currImgUrl)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment