mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: view all images of a memo (#393)
* feat: view all images of a memo * fix: function arguments * refactor: unified image preview * refactor: image preview for resource dialog Co-authored-by: XQ <qiaobingxue1998@163.com>
This commit is contained in:
@ -83,10 +83,17 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
|
||||
inputEl.click();
|
||||
};
|
||||
|
||||
const getResouceUrl = useCallback((resource: Resource) => {
|
||||
return `${window.location.origin}/o/r/${resource.id}/${resource.filename}`;
|
||||
}, []);
|
||||
|
||||
const handlePreviewBtnClick = (resource: Resource) => {
|
||||
const resourceUrl = `${window.location.origin}/o/r/${resource.id}/${resource.filename}`;
|
||||
const resourceUrl = getResouceUrl(resource);
|
||||
if (resource.type.startsWith("image")) {
|
||||
showPreviewImageDialog(resourceUrl);
|
||||
showPreviewImageDialog(
|
||||
resources.filter((r) => r.type.startsWith("image")).map((r) => getResouceUrl(r)),
|
||||
resources.findIndex((r) => r.id === resource.id)
|
||||
);
|
||||
} else {
|
||||
window.open(resourceUrl);
|
||||
}
|
||||
|
Reference in New Issue
Block a user