fix: image url extraction (#453)

fix: image-url-extraction

Co-authored-by: boojack <stevenlgtm@gmail.com>
pull/457/head
Zeng1998 2 years ago committed by GitHub
parent 0809ec8c72
commit 8cc0977a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

Loading…
Cancel
Save