This commit is contained in:
Manav Rathi
2025-03-05 11:19:12 +05:30
parent 81e3593b74
commit 7d8683640b
2 changed files with 24 additions and 0 deletions

View File

@@ -435,6 +435,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
// Not memoized since it uses the frequently changing `activeAnnotatedFile`. // Not memoized since it uses the frequently changing `activeAnnotatedFile`.
const handleCopyImage = () => { const handleCopyImage = () => {
handleMoreMenuClose();
// Safari does not copy if we do not call `navigator.clipboard.write` // Safari does not copy if we do not call `navigator.clipboard.write`
// synchronously within the click event handler, but it does supports // synchronously within the click event handler, but it does supports
// passing a promise in lieu of the blob. // passing a promise in lieu of the blob.

View File

@@ -432,9 +432,32 @@ export class FileViewerPhotoSwipe {
updateFileInfoExifIfNeeded(e.content.data), updateFileInfoExifIfNeeded(e.content.data),
); );
let el;
let listener;
pswp.on("change", (e) => { pswp.on("change", (e) => {
const itemData = this.pswp.currSlide.content.data; const itemData = this.pswp.currSlide.content.data;
updateFileInfoExifIfNeeded(itemData); updateFileInfoExifIfNeeded(itemData);
if (el && listener) {
el.removeEventListener("pause", listener);
el.removeEventListener("play", listener);
el.removeEventListener("ended", listener);
el = undefined;
listener = undefined;
}
if (itemData.fileType == FileType.video) {
setTimeout(() => {
listener = (e) => {
console.log(e);
};
// TODO:
el = document.getElementsByTagName("video")[0];
console.log(el);
el.addEventListener("pause", listener);
el.addEventListener("play", listener);
el.addEventListener("ended", listener);
}, 3000);
}
}); });
pswp.on("contentDestroy", (e) => forgetExifForItemData(e.content.data)); pswp.on("contentDestroy", (e) => forgetExifForItemData(e.content.data));