aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-06-25 18:22:13 +0200
committerV <vendicated@riseup.net>2023-06-25 18:22:36 +0200
commit2103e5211558447614c7242f7c2d14f80eadee5f (patch)
treead580c73b38a10f905e3abdfb792abc9b1b71747 /src/plugins
parentafbfb641e8eb3583890f9264e6ede78e50dff0a7 (diff)
downloadVencord-2103e5211558447614c7242f7c2d14f80eadee5f.tar.gz
Vencord-2103e5211558447614c7242f7c2d14f80eadee5f.tar.bz2
Vencord-2103e5211558447614c7242f7c2d14f80eadee5f.zip
WebContextMenus: Support all text areas
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/webContextMenus.web.ts29
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) {