aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-10-26 15:10:11 +0200
committerVendicated <vendicated@riseup.net>2022-10-26 15:10:11 +0200
commitc65f757bc450beee76c4266610a13f6f56ed7b94 (patch)
tree26370e7d627b9b65fe320fafc9e7e8ba04fb2e00 /src
parentb87f0bf3f96dce3c51f0b571e55d5d131af1d3f2 (diff)
downloadVencord-c65f757bc450beee76c4266610a13f6f56ed7b94.tar.gz
Vencord-c65f757bc450beee76c4266610a13f6f56ed7b94.tar.bz2
Vencord-c65f757bc450beee76c4266610a13f6f56ed7b94.zip
Fix betterUploadButton
Diffstat (limited to 'src')
-rw-r--r--src/plugins/betterUploadButton.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/betterUploadButton.ts b/src/plugins/betterUploadButton.ts
index 52d8aed..94c1f49 100644
--- a/src/plugins/betterUploadButton.ts
+++ b/src/plugins/betterUploadButton.ts
@@ -21,15 +21,17 @@ import definePlugin from "../utils/types";
export default definePlugin({
name: "BetterUploadButton",
- authors: [Devs.obscurity],
+ authors: [Devs.obscurity, Devs.Ven],
description: "Upload with a single click, open menu with right click",
patches: [
{
find: "Messages.CHAT_ATTACH_UPLOAD_OR_INVITE",
replacement: {
- match: /CHAT_ATTACH_UPLOAD_OR_INVITE,onDoubleClick:([^,]+),onClick:([^,]+)}}/,
- replace:
- "CHAT_ATTACH_UPLOAD_OR_INVITE,onClick:$1,onContextMenu:$2}}",
+ // Discord merges multiple props here with Object.assign()
+ // This patch passes a third object to it with which we override onClick and onContextMenu
+ match: /CHAT_ATTACH_UPLOAD_OR_INVITE,onDoubleClick:(.+?:void 0)\},(.{1,3})\)/,
+ replace: (m, onDblClick, otherProps) =>
+ `${m.slice(0, -1)},{onClick:${onDblClick},onContextMenu:${otherProps}.onClick})`,
},
},
],