ViewIcons: Use ImageModal again
This commit is contained in:
parent
a4e98f9252
commit
0d996633f2
@ -1,6 +1,12 @@
|
|||||||
import { Devs } from "../utils/constants";
|
import { Devs } from "../utils/constants";
|
||||||
import IpcEvents from "../utils/IpcEvents";
|
|
||||||
import definePlugin from "../utils/types";
|
import definePlugin from "../utils/types";
|
||||||
|
import { lazyWebpack, makeLazy } from "../utils/misc";
|
||||||
|
import { ModalSize, openModal } from "../utils/modal";
|
||||||
|
import { find } from "../webpack";
|
||||||
|
import { React } from "../webpack/common";
|
||||||
|
|
||||||
|
const ImageModal = lazyWebpack(m => m.prototype?.render?.toString().includes("OPEN_ORIGINAL_IMAGE"));
|
||||||
|
const getMaskedLink = makeLazy(() => find(m => m.type?.toString().includes("MASKED_LINK)")));
|
||||||
|
|
||||||
const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage(";
|
const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage(";
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
@ -9,16 +15,14 @@ export default definePlugin({
|
|||||||
description: "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon.",
|
description: "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon.",
|
||||||
|
|
||||||
openImage(url: string) {
|
openImage(url: string) {
|
||||||
VencordNative.ipc.invoke(IpcEvents.OPEN_EXTERNAL, url);
|
openModal(() => (
|
||||||
// husk
|
|
||||||
/* openModal(() => (
|
|
||||||
<ImageModal
|
<ImageModal
|
||||||
shouldAnimate={true}
|
shouldAnimate={true}
|
||||||
original={url}
|
original={url}
|
||||||
src={url}
|
src={url}
|
||||||
renderLinkComponent={renderMaskedLink}
|
renderLinkComponent={props => React.createElement(getMaskedLink(), props)}
|
||||||
/>
|
/>
|
||||||
), { size: Modal.ModalSize.DYNAMIC }); */
|
), { size: ModalSize.DYNAMIC });
|
||||||
},
|
},
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
|
@ -10,6 +10,13 @@ const Modals = mapMangledModuleLazy("onCloseRequest:null!=", {
|
|||||||
|
|
||||||
let modalId = 1337;
|
let modalId = 1337;
|
||||||
|
|
||||||
|
export enum ModalSize {
|
||||||
|
SMALL = "small",
|
||||||
|
MEDIUM = "medium",
|
||||||
|
LARGE = "large",
|
||||||
|
DYNAMIC = "dynamic",
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a modal
|
* Open a modal
|
||||||
* @param Component The component to render in the modal
|
* @param Component The component to render in the modal
|
||||||
|
Loading…
Reference in New Issue
Block a user