mirror of
https://github.com/usememos/memos.git
synced 2025-12-10 14:16:32 +08:00
chore: update image attrs
This commit is contained in:
parent
16e68fbfff
commit
a8074d94e8
5 changed files with 8 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ interface Props {
|
|||
}
|
||||
|
||||
const Image: React.FC<Props> = ({ altText, url }: Props) => {
|
||||
return <img alt={altText} src={url} />;
|
||||
return <img src={url} alt={altText} decoding="async" loading="lazy" />;
|
||||
};
|
||||
|
||||
export default Image;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ const MemoResourceListView = ({ resourceList = [] }: { resourceList: Resource[]
|
|||
src={resource.externalLink ? url : `${url}${thumbnail ? "?thumbnail=1" : ""}`}
|
||||
onClick={() => handleImageClick(url)}
|
||||
decoding="async"
|
||||
loading="lazy"
|
||||
/>
|
||||
);
|
||||
} else if (type === "video/*") {
|
||||
|
|
|
|||
|
|
@ -128,6 +128,8 @@ const PreviewImageDialog: React.FC<Props> = ({ destroy, imgUrls, initialIndex }:
|
|||
onTouchMove={handleTouchMove}
|
||||
onTouchEnd={handleTouchEnd}
|
||||
onWheel={handleImgContainerScroll}
|
||||
decoding="async"
|
||||
loading="lazy"
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -27,10 +27,11 @@ const ResourceIcon = (props: Props) => {
|
|||
return (
|
||||
<SquareDiv className={classNames(className, "flex items-center justify-center overflow-clip")}>
|
||||
<img
|
||||
loading="lazy"
|
||||
className="min-w-full min-h-full object-cover border rounded dark:border-none"
|
||||
src={resource.externalLink ? resourceUrl : resourceUrl + "?thumbnail=1"}
|
||||
onClick={() => showPreviewImageDialog(resourceUrl)}
|
||||
decoding="async"
|
||||
loading="lazy"
|
||||
/>
|
||||
</SquareDiv>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ const UserAvatar = (props: Props) => {
|
|||
<img
|
||||
className="w-full h-auto rounded-full shadow min-w-full min-h-full object-cover dark:opacity-80"
|
||||
src={avatarUrl || "/logo.png"}
|
||||
decoding="async"
|
||||
loading="lazy"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue