mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(ui): safari doesn't have find on iterators
This commit is contained in:
committed by
Mary Hipp Rogers
parent
1bb49b698f
commit
e38f5b1576
@@ -29,11 +29,10 @@ const onClose = () => {
|
||||
$imageContextMenuState.setKey('isOpen', false);
|
||||
};
|
||||
const elToImageMap = new Map<HTMLDivElement, ImageDTO>();
|
||||
const getImageDTOFromMap = (target: Node) => {
|
||||
const parent = elToImageMap.keys().find((el) => el.contains(target));
|
||||
return parent ? elToImageMap.get(parent) : undefined;
|
||||
const getImageDTOFromMap = (target: Node): ImageDTO | undefined => {
|
||||
const entry = Array.from(elToImageMap.entries()).find((entry) => entry[0].contains(target));
|
||||
return entry?.[1];
|
||||
};
|
||||
|
||||
export const useImageContextMenu = (imageDTO: ImageDTO | undefined, targetRef: RefObject<HTMLDivElement>) => {
|
||||
useEffect(() => {
|
||||
if (!targetRef.current || !imageDTO) {
|
||||
|
||||
Reference in New Issue
Block a user