From ad28abc8437d3bb0b4ee3d4e96fbac7ec50440c4 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Tue, 9 Jun 2026 22:35:36 -0400 Subject: [PATCH] Drop ViewRawVariant in favor of ViewRaw (a direct replacement) --- src/equicordplugins/viewRawVariant/index.tsx | 134 ------------------- src/plugins/viewRaw/style.css | 5 + 2 files changed, 5 insertions(+), 134 deletions(-) delete mode 100644 src/equicordplugins/viewRawVariant/index.tsx create mode 100644 src/plugins/viewRaw/style.css diff --git a/src/equicordplugins/viewRawVariant/index.tsx b/src/equicordplugins/viewRawVariant/index.tsx deleted file mode 100644 index 77e93b2cf..000000000 --- a/src/equicordplugins/viewRawVariant/index.tsx +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { NavContextMenuPatchCallback } from "@api/ContextMenu"; -import { CodeBlock } from "@components/CodeBlock"; -import { Divider } from "@components/Divider"; -import ErrorBoundary from "@components/ErrorBoundary"; -import { Heading } from "@components/Heading"; -import { Devs } from "@utils/constants"; -import { getIntlMessage } from "@utils/discord"; -import { Margins } from "@utils/margins"; -import definePlugin from "@utils/types"; -import { Message } from "@vencord/discord-types"; -import { Menu, Modal,openModal } from "@webpack/common"; - -type CustomMessage = Message & { - editHistory?: any; - deleted?: any; - firstEditTimestamp?: any; -}; - -const CopyIcon = () => { - return ( - - ); -}; - -function cleanMessage(msg: CustomMessage) { - const author = { ...msg.author } as any; - delete author.email; - delete author.phone; - delete author.mfaEnabled; - delete author.personalConnectionId; - delete msg.editHistory; - delete msg.deleted; - delete msg.firstEditTimestamp; - return { ...msg, author }; -} - -function openViewRawModal(obj: any, type: string, isMessage?: boolean) { - openModal(props => ( - - -
- {isMessage && ( - <> - - Content - - - - - )} - - {type} Data - -
-
-
- )); -} - -function makeContextCallback( - name: string, - action: (any) => void, -): NavContextMenuPatchCallback { - return (children, props) => { - if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL")) - return; // random shit like notification settings - - const value = props[name]; - if (!value) return; - - const lastChild = children.at(-1); - if (lastChild?.key === "developer-actions") { - const p = lastChild.props; - if (!Array.isArray(p.children)) p.children = [p.children]; - - children = p.children; - } - - children.push( - action(value)} - icon={CopyIcon} - />, - ); - }; -} - -export default definePlugin({ - name: "ViewRawVariant", - description: "Copy/View raw content of any message, channel, or guild, but show in the right click menu.", - tags: ["Appearance", "Customisation", "Chat", "Organisation", "Servers"], - authors: [Devs.KingFish, Devs.Ven, Devs.rad, Devs.ImLvna, Devs.Kyuuhachi], - contextMenus: { - "guild-context": makeContextCallback("guild", val => - openViewRawModal(val, "Guild"), - ), - "channel-context": makeContextCallback("channel", val => - openViewRawModal(val, "Channel"), - ), - "user-context": makeContextCallback("user", val => - openViewRawModal(val, "User"), - ), - message: makeContextCallback("message", val => - openViewRawModal(cleanMessage(val), "Message", true), - ), - }, -}); diff --git a/src/plugins/viewRaw/style.css b/src/plugins/viewRaw/style.css new file mode 100644 index 000000000..a9dd3fdd0 --- /dev/null +++ b/src/plugins/viewRaw/style.css @@ -0,0 +1,5 @@ +.vc-viewraw-codeblock { + white-space: nowrap !important; + word-break: normal !important; + min-width: 40px !important; +} \ No newline at end of file