From e907ea3236c639a269ca957afb99b72cfb2c268f Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:47:53 -0500 Subject: [PATCH] Reapply "Fix Broken Patches" This reverts commit 5050e18c4e657886f66a06d7d8b67b982b71ae7e. --- src/api/ChatButtons.tsx | 16 ++++++++++---- src/equicordplugins/anammox/index.ts | 2 +- src/equicordplugins/commandPalette/index.tsx | 2 +- src/equicordplugins/hideChatButtons/index.tsx | 2 +- src/equicordplugins/moreStickers/index.tsx | 22 ++++++++++++++----- src/plugins/_api/chatButtons.ts | 4 ++-- 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/api/ChatButtons.tsx b/src/api/ChatButtons.tsx index 2fea24d3d..046f975bb 100644 --- a/src/api/ChatButtons.tsx +++ b/src/api/ChatButtons.tsx @@ -80,15 +80,23 @@ export type ChatBarButtonFactory = (props: ChatBarProps & { isMainChat: boolean; const buttonFactories = new Map(); const logger = new Logger("ChatButtons"); -export function _injectButtons(buttons: ReactNode[], props: ChatBarProps) { +export function _injectButtons(buttons: { key: string, node: ReactNode; }[], order: Record, props: ChatBarProps) { if (props.disabled) return; + let anchorIndex = -100; + let currentOrder = anchorIndex - 1; + for (const [key, Button] of buttonFactories) { - buttons.push( - logger.error(`Failed to render ${key}`, e.error)}> + order[key] = anchorIndex; + order.submit && (order.submit = ++currentOrder); + anchorIndex = currentOrder + 1; + + buttons.push({ + key, + node: logger.error(`Failed to render ${key}`, e.error)}>