Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

more

Manav Rathidce95ad4f118
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 1a8244c39a..30afccb4a3 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -266,6 +266,16 @@ const FileViewer: React.FC<FileViewerProps> = ({
: undefined;
}, [onSelectPerson, handleClose]);
+ const handleMore = useCallback(
+ (
+ annotatedFile: FileViewerAnnotatedFile,
+ buttonElement: HTMLElement,
+ ) => {
+ console.log({ annotatedFile, buttonElement });
+ },
+ [],
+ );
+
const handleEditImage = useMemo(() => {
return onSaveEditedImageCopy
? (annotatedFile: FileViewerAnnotatedFile) => {
@@ -336,6 +346,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
onClose: handleClose,
onAnnotate: handleAnnotate,
onViewInfo: handleViewInfo,
+ onMore: handleMore,
onEditImage: handleEditImage,
});
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index a421309941..8d60b8dbda 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -135,6 +135,16 @@ type FileViewerPhotoSwipeOptions = Pick<
* Called when the user activates the info action on a file.
*/
onViewInfo: (annotatedFile: FileViewerAnnotatedFile) => void;
+ /**
+ * Called when the user activates the more action on a file.
+ *
+ * In addition to the file, callback is also passed a reference to the HTML
+ * DOM more button element.
+ */
+ onMore: (
+ annotatedFile: FileViewerAnnotatedFile,
+ buttonElement: HTMLElement,
+ ) => void;
/**
* Called when the user activates the edit action on an image.
*
@@ -228,6 +238,7 @@ export class FileViewerPhotoSwipe {
onClose,
onAnnotate,
onViewInfo,
+ onMore,
onEditImage,
}: FileViewerPhotoSwipeOptions) {
this.opts = { disableDownload };
@@ -605,7 +616,7 @@ export class FileViewerPhotoSwipe {
order: 17,
isButton: true,
html: createPSRegisterElementIconHTML("more"),
- // onClick: withCurrentAnnotatedFile(delegate.onViewInfo),
+ onClick: (e) => onMore(currentAnnotatedFile(), e.target),
});
});