From 6769de29cdae4dc4e5b6ab4684380706c336845f Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Fri, 21 Oct 2022 16:18:32 -0600 Subject: [PATCH] feat(api): add Clipboard entry in webpack common (#127) --- src/webpack/common.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/webpack/common.tsx b/src/webpack/common.tsx index 44cb2b5dd..6846349c1 100644 --- a/src/webpack/common.tsx +++ b/src/webpack/common.tsx @@ -1,7 +1,7 @@ import { User } from "discord-types/general"; import { lazyWebpack } from "../utils/misc"; -import { _resolveReady, filters, waitFor } from "./webpack"; +import { _resolveReady, filters, waitFor, mapMangledModuleLazy } from "./webpack"; import type Components from "discord-types/components"; import type Stores from "discord-types/stores"; @@ -93,6 +93,11 @@ export const UserUtils = { fetchUser: lazyWebpack(filters.byCode(".USER(", "getUser")) as (id: string) => Promise, }; +export const Clipboard = mapMangledModuleLazy('document.queryCommandEnabled("copy")||document.queryCommandSupported("copy")', { + copy: filters.byCode(".default.copy("), + SUPPORTS_COPY: x => typeof x === "boolean", +}); + waitFor("useState", m => React = m); waitFor(["dispatch", "subscribe"], m => { FluxDispatcher = m;