diff --git a/src/plugins/_api/messageEvents.ts b/src/plugins/_api/messageEvents.ts index e5192763c..3030db039 100644 --- a/src/plugins/_api/messageEvents.ts +++ b/src/plugins/_api/messageEvents.ts @@ -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};" diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index ce9f6b515..57144ec08 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -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; @@ -22,7 +22,7 @@ interface UserProfileProps { const UserProfile = findComponentByCodeLazy(".POPOUT,user"); let openAlternatePopout = false; -let accountPanelRef: React.RefObject | null> = { current: null }; +let accountPanelRef: React.RefObject = { 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(); }} /> ){(.+?)}(?=,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) { + accountPanelRef = ref; + return ref; }, openAccountPanelContextMenu(event: React.UIEvent) { diff --git a/src/plugins/reviewDB/components/ReviewsView.tsx b/src/plugins/reviewDB/components/ReviewsView.tsx index 93d7ee436..142fc37ec 100644 --- a/src/plugins/reviewDB/components/ReviewsView.tsx +++ b/src/plugins/reviewDB/components/ReviewsView.tsx @@ -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(null); - const inputType = ChatInputTypes.FORM; + const inputType = ChatInputTypes.USER_PROFILE_REPLY; inputType.disableAutoFocus = true; const channel = createChannelRecordFromServer({ id: "0", type: 1 }); diff --git a/src/plugins/reviewDB/style.css b/src/plugins/reviewDB/style.css index 5490f7f84..0622a0167 100644 --- a/src/plugins/reviewDB/style.css +++ b/src/plugins/reviewDB/style.css @@ -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; -}