diff --git a/src/plugins/philsPluginLibrary/index.tsx b/src/plugins/philsPluginLibrary/index.tsx index 0f262ecdb6c..c5fd2000789 100644 --- a/src/plugins/philsPluginLibrary/index.tsx +++ b/src/plugins/philsPluginLibrary/index.tsx @@ -34,14 +34,15 @@ export default new class Plugin implements PluginDef { this.name = PluginInfo.PLUGIN_NAME; this.description = PluginInfo.DESCRIPTION; this.authors = PluginInfo.AUTHORS as PluginAuthor[]; + + this.replacedUserPanelComponent = replacedUserPanelComponent.bind(this); this.patches = [{ - find: "Messages.ACCOUNT_A11Y_LABEL", + find: "--custom-app-panels-height", replacement: { - match: /(?<=function)( .{0,3}(?={).)(.{0,1000}custom-app-panels-height.+?\)]}\))(})/, - replace: "$1return $self.replacedUserPanelComponent(function(){$2}, this, arguments)$3" + match: /(\w+\.\w+\(\w+,{\w+:function\(\){)return (\w)+}/, + replace: "$1 $self.storedComp = $2; return $self.replacedUserPanelComponent}" } }]; - this.replacedUserPanelComponent = replacedUserPanelComponent; } }; diff --git a/src/plugins/philsPluginLibrary/patches/userPanel.tsx b/src/plugins/philsPluginLibrary/patches/userPanel.tsx index a17309ad2cc..91f2a9e11b6 100644 --- a/src/plugins/philsPluginLibrary/patches/userPanel.tsx +++ b/src/plugins/philsPluginLibrary/patches/userPanel.tsx @@ -81,14 +81,13 @@ export const ButtonsSettingsPanel = () => { ; }; -export function replacedUserPanelComponent(oldComponent: (...args: any[]) => any, thisContext: any, functionArguments: any) { - const componentResult: JSX.Element = Reflect.apply(oldComponent, thisContext, functionArguments); - +export function replacedUserPanelComponent() { + // @ts-ignore + const componentResult: JSX.Element = this.storedComp(); if (!componentResult?.props) return componentResult; const { children } = componentResult.props; - children.splice(children.length - 1, 0, );