diff options
-rw-r--r-- | src/plugins/webContextMenus.web.ts | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/plugins/webContextMenus.web.ts b/src/plugins/webContextMenus.web.ts index 39933fb..7ec6348 100644 --- a/src/plugins/webContextMenus.web.ts +++ b/src/plugins/webContextMenus.web.ts @@ -47,9 +47,10 @@ const settings = definePluginSettings({ export default definePlugin({ name: "WebContextMenus", - description: "Re-adds context menus missing in the web version of Discord: Images, ChatInputBar, Links, 'Copy Link', 'Open Link', 'Copy Image', 'Save Image'", + description: "Re-adds context menus missing in the web version of Discord: Links & Images (Copy/Open Link/Image), Text Area (Copy, Cut, Paste, SpellCheck)", authors: [Devs.Ven], enabledByDefault: true, + required: IS_VENCORD_DESKTOP, settings, @@ -146,36 +147,30 @@ export default definePlugin({ } }, { - find: ':"command-suggestions"', + find: 'navId:"textarea-context"', + all: true, predicate: () => settings.store.addBack, replacement: [ { - // desktopOnlyEntries = makeEntries(), spellcheckChildren = desktopOnlyEntries[0], languageChildren = desktopOnlyEntries[1] - match: /\i=.{0,30}text:\i,target:\i,onHeightUpdate:\i\}\),2\),(\i)=\i\[0\],(\i)=\i\[1\]/, - // set spellcheckChildren & languageChildren to empty arrays, so just in case patch 3 fails, we don't - // reference undefined variables - replace: "$1=[],$2=[]", - }, - { // if (!IS_DESKTOP) return null; match: /if\(!\i\.\i\)return null;/, replace: "" }, { - // do not add menu items for entries removed in patch 1. Using a lookbehind for group 1 is slow, - // so just capture and add back - match: /("submit-button".+?)(\(0,\i\.jsx\)\(\i\.MenuGroup,\{children:\i\}\),){2}/, - replace: "$1" - }, - { // Change calls to DiscordNative.clipboard to us instead match: /\b\i\.default\.(copy|cut|paste)/g, replace: "$self.$1" } ] + }, + { + find: '"add-to-dictionary"', + predicate: () => settings.store.addBack, + replacement: { + match: /var \i=\i\.text,/, + replace: "return [null,null];$&" + } } - - // TODO: Maybe add spellcheck for VencordDesktop ], async copyImage(url: string) { |