WebContextMenus: Support all text areas
This commit is contained in:
parent
afbfb641e8
commit
2103e52115
|
@ -47,9 +47,10 @@ const settings = definePluginSettings({
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "WebContextMenus",
|
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],
|
authors: [Devs.Ven],
|
||||||
enabledByDefault: true,
|
enabledByDefault: true,
|
||||||
|
required: IS_VENCORD_DESKTOP,
|
||||||
|
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
|
@ -146,36 +147,30 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ':"command-suggestions"',
|
find: 'navId:"textarea-context"',
|
||||||
|
all: true,
|
||||||
predicate: () => settings.store.addBack,
|
predicate: () => settings.store.addBack,
|
||||||
replacement: [
|
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;
|
// if (!IS_DESKTOP) return null;
|
||||||
match: /if\(!\i\.\i\)return null;/,
|
match: /if\(!\i\.\i\)return null;/,
|
||||||
replace: ""
|
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
|
// Change calls to DiscordNative.clipboard to us instead
|
||||||
match: /\b\i\.default\.(copy|cut|paste)/g,
|
match: /\b\i\.default\.(copy|cut|paste)/g,
|
||||||
replace: "$self.$1"
|
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) {
|
async copyImage(url: string) {
|
||||||
|
|
Loading…
Reference in a new issue