This commit is contained in:
thororen1234 2024-06-18 22:37:54 -04:00
commit 2e40a9e07b
48 changed files with 400 additions and 154 deletions

View file

@ -120,6 +120,8 @@ export function openImageModal(url: string, props?: Partial<React.ComponentProps
placeholder={url}
src={url}
renderLinkComponent={props => <MaskedLink {...props} />}
// FIXME: wtf is this? do we need to pass some proper component??
renderForwardComponent={() => null}
shouldHideMediaOptions={false}
shouldAnimate
{...props}

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { findByPropsLazy, findExportedComponentLazy } from "@webpack";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react";
import { LazyComponent } from "./react";
@ -111,6 +111,7 @@ export type ImageModal = ComponentType<{
animated?: boolean;
responsive?: boolean;
renderLinkComponent(props: any): ReactNode;
renderForwardComponent(props: any): ReactNode;
maxWidth?: number;
maxHeight?: number;
shouldAnimate?: boolean;
@ -118,7 +119,7 @@ export type ImageModal = ComponentType<{
shouldHideMediaOptions?: boolean;
}>;
export const ImageModal = findExportedComponentLazy("ImageModal") as ImageModal;
export const ImageModal = findComponentByCodeLazy(".MEDIA_MODAL_CLOSE", "responsive") as ImageModal;
export const ModalRoot = LazyComponent(() => Modals.ModalRoot);
export const ModalHeader = LazyComponent(() => Modals.ModalHeader);