Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
thororen1234 2025-08-11 22:43:40 -04:00
commit 62e4a14fba
No known key found for this signature in database
4 changed files with 15 additions and 64 deletions

View file

@ -35,10 +35,10 @@ export default definePlugin({
}
},
{
find: ".handleSendMessage,onResize",
find: ".handleSendMessage,onResize:",
replacement: {
// https://regex101.com/r/hBlXpl/1
match: /let (\i)=\i\.\i\.parse\((\i),.+?let (\i)=\i\.\i\.getSendMessageOptions\(\{.+?\}\);(?<=\)\(({.+?})\)\.then.+?)/,
// https://regex101.com/r/7iswuk/1
match: /let (\i)=\i\.\i\.parse\((\i),.+?\.getSendMessageOptions\(\{.+?\}\);(?=.+?(\i)\.flags=)(?<=\)\(({.+?})\)\.then.+?)/,
replace: (m, parsedMessage, channel, replyOptions, extra) => m +
`if(await Vencord.Api.MessageEvents._handlePreSend(${channel}.id,${parsedMessage},${extra},${replyOptions}))` +
"return{shouldClear:false,shouldRefocus:true};"

View file

@ -11,7 +11,7 @@ import { getCurrentChannel } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { User } from "@vencord/discord-types";
import { findComponentByCodeLazy } from "@webpack";
import { ContextMenuApi, Menu, useEffect, useRef } from "@webpack/common";
import { ContextMenuApi, Menu } from "@webpack/common";
interface UserProfileProps {
popoutProps: Record<string, any>;
@ -22,7 +22,7 @@ interface UserProfileProps {
const UserProfile = findComponentByCodeLazy(".POPOUT,user");
let openAlternatePopout = false;
let accountPanelRef: React.RefObject<Record<PropertyKey, any> | null> = { current: null };
let accountPanelRef: React.RefObject<HTMLDivElement | null> = { current: null };
const AccountPanelContextMenu = ErrorBoundary.wrap(() => {
const { prioritizeServerProfile } = settings.use(["prioritizeServerProfile"]);
@ -38,8 +38,7 @@ const AccountPanelContextMenu = ErrorBoundary.wrap(() => {
disabled={getCurrentChannel()?.getGuildId() == null}
action={e => {
openAlternatePopout = true;
accountPanelRef.current?.props.onMouseDown();
accountPanelRef.current?.props.onClick(e);
accountPanelRef.current?.click();
}}
/>
<Menu.MenuCheckboxItem
@ -71,10 +70,6 @@ export default definePlugin({
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
group: true,
replacement: [
{
match: /let{ref:\i,speaking:\i/,
replace: "$self.useAccountPanelRef();$&"
},
{
match: /(\.AVATAR,children:.+?renderPopout:\((\i),\i\)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,
replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalRenderPopout:()=>{${originalPopout}}})`
@ -84,8 +79,8 @@ export default definePlugin({
replace: "$&$self.onPopoutClose();"
},
{
match: /(?<=#{intl::SET_STATUS}\),)/,
replace: "ref:$self.accountPanelRef,onContextMenu:$self.openAccountPanelContextMenu,"
match: /#{intl::SET_STATUS}\)(?<=innerRef:(\i),style:.+?)/,
replace: "$&,onContextMenu:($self.grabRef($1),$self.openAccountPanelContextMenu)"
}
]
}
@ -95,12 +90,9 @@ export default definePlugin({
return accountPanelRef;
},
useAccountPanelRef() {
useEffect(() => () => {
accountPanelRef.current = null;
}, []);
return (accountPanelRef = useRef(null));
grabRef(ref: React.RefObject<HTMLDivElement>) {
accountPanelRef = ref;
return ref;
},
openAccountPanelContextMenu(event: React.UIEvent) {

View file

@ -29,8 +29,8 @@ import ReviewComponent from "./ReviewComponent";
const Transforms = findByPropsLazy("insertNodes", "textToText");
const Editor = findByPropsLazy("start", "end", "toSlateRange");
const ChatInputTypes = findByPropsLazy("FORM");
const InputComponent = findComponentByCodeLazy("disableThemedBackground", "CHANNEL_TEXT_AREA");
const ChatInputTypes = findByPropsLazy("FORM", "USER_PROFILE");
const InputComponent = findComponentByCodeLazy("editorClassName", "CHANNEL_TEXT_AREA");
const createChannelRecordFromServer = findByCodeLazy(".GUILD_TEXT])", "fromServer)");
interface UserProps {
@ -127,7 +127,7 @@ export function ReviewsInputComponent(
) {
const { token } = Auth;
const editorRef = useRef<any>(null);
const inputType = ChatInputTypes.FORM;
const inputType = ChatInputTypes.USER_PROFILE_REPLY;
inputType.disableAutoFocus = true;
const channel = createChannelRecordFromServer({ id: "0", type: 1 });

View file

@ -9,6 +9,7 @@
}
.vc-rdb-input {
padding-left: 12px;
margin-top: 6px;
margin-bottom: 12px;
resize: none;
@ -134,45 +135,3 @@
.vc-rdb-block-modal-unblock {
cursor: pointer;
}
.vc-rdb-avatar {
z-index: 1 !important;
}
.vc-rdb-white-line {
position: absolute;
left: calc(var(--vc-rdb-avatar-size) / 2);
top: calc(var(--vc-rdb-avatar-size) + 2 * var(--vc-rdb-spacing-size));
width: 2px;
height: calc(100% - var(--vc-rdb-avatar-size) - 4 * var(--vc-rdb-spacing-size) - 2px);
;
border-left: 3px solid gray;
}
.vc-rdb-reply-line {
position: relative;
border: 3px solid gray;
border-top: none;
border-right: none;
border-bottom-left-radius: 20px;
height: calc(8px);
width: calc(24px);
top: calc(var(--vc-rdb-avatar-size) / 2 + 4px);
left: calc(var(--vc-rdb-avatar-size) * -2 - 4px);
}
.vc-rdb-profile-photo-container {
position: relative;
}
.vc-rdb-buttons {
opacity: 0;
}
.vc-rdb-reply:hover>.vc-rdb-buttons {
opacity: 1;
}
.vc-rdb-review:hover>.vc-rdb-buttons {
opacity: 1;
}