Merge branch 'Vendicated:main' into main

This commit is contained in:
Davilarek 2025-05-01 23:24:55 +02:00 committed by GitHub
commit 4da95d3f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 24 additions and 13 deletions

View file

@ -21,6 +21,7 @@ import { definePluginSettings } from "@api/Settings";
import { makeRange } from "@components/PluginSettings/components";
import { debounce } from "@shared/debounce";
import { Devs } from "@utils/constants";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { Menu, ReactDOM } from "@webpack/common";
import { JSX } from "react";
@ -237,12 +238,16 @@ export default definePlugin({
},
renderMagnifier(instance) {
if (instance.props.id === ELEMENT_ID) {
if (!this.currentMagnifierElement) {
this.currentMagnifierElement = <Magnifier size={settings.store.size} zoom={settings.store.zoom} instance={instance} />;
this.root = ReactDOM.createRoot(this.element!);
this.root.render(this.currentMagnifierElement);
try {
if (instance.props.id === ELEMENT_ID) {
if (!this.currentMagnifierElement) {
this.currentMagnifierElement = <Magnifier size={settings.store.size} zoom={settings.store.zoom} instance={instance} />;
this.root = ReactDOM.createRoot(this.element!);
this.root.render(this.currentMagnifierElement);
}
}
} catch (error) {
new Logger("ImageZoom").error("Failed to render magnifier:", error);
}
},

View file

@ -32,7 +32,7 @@ const SelectedChannelActionCreators = findByPropsLazy("selectPrivateChannel");
const UserUtils = findByPropsLazy("getGlobalName");
const ProfileListClasses = findByPropsLazy("emptyIconFriends", "emptyIconGuilds");
const ExpandableList = findComponentByCodeLazy('"PRESS_SECTION"');
const ExpandableList = findComponentByCodeLazy('"PRESS_SECTION"', ".header");
const GuildLabelClasses = findByPropsLazy("guildNick", "guildAvatarWithoutIcon");
function getGroupDMName(channel: Channel) {

View file

@ -1,4 +1,3 @@
.vc-mutual-gdms-tab-bar {
gap: 0;
justify-content: space-between;
}

View file

@ -16,7 +16,7 @@ import { FluxDispatcher, Forms, GuildChannelStore, GuildMemberStore, GuildStore,
import { Guild, User } from "discord-types/general";
const IconClasses = findByPropsLazy("icon", "acronym", "childWrapper");
const FriendRow = findComponentByCodeLazy(".listName,discriminatorClass");
const FriendRow = findComponentByCodeLazy("discriminatorClass:", ".isMobileOnline", "getAvatarURL");
const cl = classNameFactory("vc-gp-");

View file

@ -50,7 +50,6 @@
border-bottom: 2px solid transparent;
color: var(--interactive-normal);
cursor: pointer;
height: 39px;
line-height: 14px;
}

View file

@ -48,9 +48,10 @@ export default definePlugin({
authors: [Devs.Rini, Devs.TheKodeToad],
patches: [
{
find: '?"@":""',
find: '"BaseUsername"',
replacement: {
match: /(?<=onContextMenu:\i,children:)\i\+\i/,
/* TODO: remove \i+\i once change makes it to stable */
match: /(?<=onContextMenu:\i,children:)(?:\i\+\i|\i)/,
replace: "$self.renderUsername(arguments[0])"
}
},

View file

@ -120,6 +120,13 @@ export default definePlugin({
]
},
{
find: "Copy image not supported",
replacement: {
match: /(?<=(?:canSaveImage|canCopyImage)\(\i?\)\{.{0,50})!\i\.isPlatformEmbedded/g,
replace: "false"
}
},
// Add back Copy & Save Image
{
find: 'id:"copy-image"',
@ -130,7 +137,7 @@ export default definePlugin({
replace: "false"
},
{
match: /return\s*?\[\i\.\i\.canCopyImage\(\)/,
match: /return\s*?\[.{0,50}?(?=\?.{0,100}?id:"copy-image")/,
replace: "return [true"
},
{

View file

@ -28,7 +28,7 @@ export let useRef: typeof React.useRef;
export let useReducer: typeof React.useReducer;
export let useCallback: typeof React.useCallback;
export const ReactDOM: typeof import("react-dom") & typeof import("react-dom/client") = findByPropsLazy("createPortal", "render");
export const ReactDOM: typeof import("react-dom") & typeof import("react-dom/client") = findByPropsLazy("createPortal");
waitFor("useState", m => {
React = m;