mirror of
https://github.com/usememos/memos.git
synced 2025-02-20 21:30:55 +01:00
fix: image url extraction (#453)
fix: image-url-extraction Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
parent
0809ec8c72
commit
8cc0977a01
@ -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…
x
Reference in New Issue
Block a user