Fixes For WebContextMenus
Some checks are pending
Release / Build Equicord (push) Waiting to run
Test / Test (push) Waiting to run

This commit is contained in:
thororen1234 2025-05-13 18:37:36 -04:00
parent 62b8997443
commit 0b9fde4bf0
No known key found for this signature in database

View file

@ -36,17 +36,16 @@ async function fetchImage(url: string) {
return await res.blob();
}
let result;
switch (true) {
case IS_VESKTOP || IS_EQUIBOP:
case "legcord" in window:
case "goofcord" in window:
result = true;
break;
default:
result = false;
}
let requiredByPlatform = false;
let hideSetting = false;
if (IS_VESKTOP || IS_EQUIBOP) {
requiredByPlatform = true;
hideSetting = true;
} else if ("legcord" in window || "goofcord" in window) {
requiredByPlatform = true;
hideSetting = false;
}
const settings = definePluginSettings({
// This needs to be all in one setting because to enable any of these, we need to make Discord use their desktop context
@ -54,15 +53,15 @@ const settings = definePluginSettings({
addBack: {
type: OptionType.BOOLEAN,
description: "Add back the Discord context menus for images, links and the chat input bar",
default: false,
default: true,
restartNeeded: true,
// Web slate menu has proper spellcheck suggestions and image context menu is also pretty good,
// so disable this by default. Vesktop just doesn't, so we force enable it there
hidden: result,
hidden: hideSetting,
}
});
const shouldAddBackMenus = () => result || settings.store.addBack;
const shouldAddBackMenus = () => hideSetting || settings.store.addBack;
const MEDIA_PROXY_URL = "https://media.discordapp.net";
const CDN_URL = "cdn.discordapp.com";
@ -91,7 +90,7 @@ export default definePlugin({
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: result,
required: requiredByPlatform,
settings,