diff --git a/src/components/CodeBlock.tsx b/src/components/CodeBlock.tsx index e85e7ed7d..b4a1ccbb8 100644 --- a/src/components/CodeBlock.tsx +++ b/src/components/CodeBlock.tsx @@ -4,6 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +import { classes } from "@utils/misc"; import { findCssClassesLazy } from "@webpack"; import { Parser } from "@webpack/common"; @@ -12,9 +13,9 @@ const CodeContainerClasses = findCssClassesLazy("markup", "codeContainer"); /** * Renders code in a Discord codeblock */ -export function CodeBlock(props: { content?: string, lang: string; }) { +export function CodeBlock({ className, ...props }: { content?: string, lang: string; className?: string; }) { return ( -
+
{Parser.defaultRules.codeBlock.react(props, null, {})}
); @@ -23,9 +24,9 @@ export function CodeBlock(props: { content?: string, lang: string; }) { /** * Renders inline code like `this` */ -export function InlineCode({ children }: { children: React.ReactNode; }) { +export function InlineCode({ children, className }: { children: React.ReactNode; className?: string; }) { return ( - + {children} ); diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx index 8d9809988..9d3617812 100644 --- a/src/plugins/viewRaw/index.tsx +++ b/src/plugins/viewRaw/index.tsx @@ -16,22 +16,24 @@ * along with this program. If not, see . */ +import "./style.css"; + import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { definePluginSettings } from "@api/Settings"; import { CodeBlock } from "@components/CodeBlock"; -import { Divider } from "@components/Divider"; import ErrorBoundary from "@components/ErrorBoundary"; +import { HeadingSecondary } from "@components/Heading"; +import { Margins } from "@components/margins"; import { Devs } from "@utils/constants"; import { copyWithToast, getCurrentGuild, getIntlMessage } from "@utils/discord"; import { isTruthy } from "@utils/guards"; -import { Margins } from "@utils/margins"; import definePlugin, { IconComponent, OptionType } from "@utils/types"; import { Message } from "@vencord/discord-types"; -import { ChannelStore, Forms, GuildRoleStore, Menu, Modal, openModal, UserProfileStore } from "@webpack/common"; +import { ChannelStore, GuildRoleStore, Menu, Modal, openModal, UserProfileStore } from "@webpack/common"; import { MouseEventHandler } from "react"; -const CopyIcon: IconComponent = ({ height = 20, width = 20, className }) => { +const CopyRawIcon: IconComponent = ({ height = 20, width = 20, className }) => { return ( copyWithToast(json, `${type} data copied to clipboard!`) }, msgContent && { @@ -92,14 +94,12 @@ function openViewRawModal(json: string, type: string, msgContent?: string) { > {!!msgContent && ( <> - Content - - + Message Content + + Message Data )} - - {type} Data - + )); @@ -150,7 +150,7 @@ function MakeContextCallback(name: "Guild" | "Role" | "User" | "Channel" | "Mess id={id} label="View Raw" action={action} - icon={CopyIcon} + icon={CopyRawIcon} /> ); }; @@ -168,7 +168,7 @@ const devContextCallback: NavContextMenuPatchCallback = (children, { id }: { id: id={"vc-view-role-raw"} label="View Raw" action={() => openViewRawModal(JSON.stringify(role, null, 4), "Role")} - icon={CopyIcon} + icon={CopyRawIcon} /> ); }; @@ -193,7 +193,7 @@ export default definePlugin({ }, messagePopoverButton: { - icon: CopyIcon, + icon: CopyRawIcon, render(msg) { const handleClick = () => { if (settings.store.clickMethod === "Right") { @@ -221,7 +221,7 @@ export default definePlugin({ return { label, - icon: CopyIcon, + icon: CopyRawIcon, message: msg, channel: ChannelStore.getChannel(msg.channel_id), onClick: handleClick, diff --git a/src/plugins/viewRaw/style.css b/src/plugins/viewRaw/style.css new file mode 100644 index 000000000..a283f7405 --- /dev/null +++ b/src/plugins/viewRaw/style.css @@ -0,0 +1,6 @@ +.vc-viewRaw-codeBlock, +.vc-viewRaw-codeBlock :is(pre, code, [class*="codeContainer"]) { + max-width: unset; + width: 100%; + box-sizing: border-box; +} \ No newline at end of file