mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 10:27:03 -04:00
Badges: Fix custom badges being turned into orbs
This commit is contained in:
parent
4e32126e5d
commit
8d0f312122
3 changed files with 26 additions and 16 deletions
|
@ -73,19 +73,17 @@ export default definePlugin({
|
|||
find: ".description,delay:",
|
||||
replacement: [
|
||||
{
|
||||
// alt: "", aria-hidden: false, src: originalSrc
|
||||
match: /alt:" ","aria-hidden":!0,src:(?=.{0,20}(\i)\.icon)/,
|
||||
// ...badge.props, ..., src: badge.image ?? ...
|
||||
replace: "...$1.props,$& $1.image??"
|
||||
match: /(alt:" ","aria-hidden":!0,src:)(.{0,20}(\i)\.icon\))/,
|
||||
replace: (_, rest, originalSrc, badge) => `...${badge}.props,${rest}${badge}.image??(${originalSrc})`
|
||||
},
|
||||
{
|
||||
match: /(?<="aria-label":(\i)\.description,.{0,200})children:/,
|
||||
replace: "children:$1.component ? $self.renderBadgeComponent({ ...$1 }) :"
|
||||
replace: "children:$1.component?$self.renderBadgeComponent({...$1}) :"
|
||||
},
|
||||
// conditionally override their onClick with badge.onClick if it exists
|
||||
{
|
||||
match: /href:(\i)\.link/,
|
||||
replace: "...($1.onClick && { onClick: vcE => $1.onClick(vcE, $1) }),$&"
|
||||
replace: "...($1.onClick&&{onClick:vcE=>$1.onClick(vcE,$1)}),$&"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -153,13 +153,7 @@ function makeShortcuts() {
|
|||
openModal: { getter: () => ModalAPI.openModal },
|
||||
openModalLazy: { getter: () => ModalAPI.openModalLazy },
|
||||
|
||||
Stores: {
|
||||
getter: () => Object.fromEntries(
|
||||
Common.Flux.Store.getAll()
|
||||
.map(store => [store.getName(), store] as const)
|
||||
.filter(([name]) => name.length > 1)
|
||||
)
|
||||
}
|
||||
Stores: Webpack.fluxStores
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue