mirror of
https://github.com/ente-io/ente.git
synced 2025-08-14 02:07:33 +00:00
Handle
This commit is contained in:
@@ -35,7 +35,7 @@ import {
|
|||||||
} from "@/new/photos/components/ImageEditorOverlay";
|
} from "@/new/photos/components/ImageEditorOverlay";
|
||||||
import { Button, Menu, MenuItem, styled } from "@mui/material";
|
import { Button, Menu, MenuItem, styled } from "@mui/material";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { fileInfoExifForFile } from "./data-source";
|
import { fileInfoExifForFile, updateItemDataAlt } from "./data-source";
|
||||||
import {
|
import {
|
||||||
FileViewerPhotoSwipe,
|
FileViewerPhotoSwipe,
|
||||||
moreButtonID,
|
moreButtonID,
|
||||||
@@ -395,7 +395,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const handleUpdateCaption = useCallback((updatedFile: EnteFile) => {
|
const handleUpdateCaption = useCallback((updatedFile: EnteFile) => {
|
||||||
console.log("TODO", updatedFile);
|
updateItemDataAlt(updatedFile);
|
||||||
psRef.current!.refreshCurrentSlideContent();
|
psRef.current!.refreshCurrentSlideContent();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@@ -301,6 +301,19 @@ export const forgetFailedItemDataForFileID = (fileID: number) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the alt attribute of the {@link ItemData}, if any, associated with the
|
||||||
|
* given {@link EnteFile}.
|
||||||
|
*
|
||||||
|
* @param updatedFile The file whose caption was updated.
|
||||||
|
*/
|
||||||
|
export const updateItemDataAlt = (updatedFile: EnteFile) => {
|
||||||
|
const itemData = _state.itemDataByFileID.get(updatedFile.id);
|
||||||
|
if (itemData) {
|
||||||
|
itemData.alt = fileCaption(updatedFile);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forget item data for the all files whose fetch had failed.
|
* Forget item data for the all files whose fetch had failed.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user