Dearrow: Fix button
This commit is contained in:
parent
e08d49edac
commit
3a5b70d410
|
@ -74,8 +74,8 @@ async function embedDidMount(this: Component<Props>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderButton(this: Component<Props>) {
|
function renderButton(component: Component<Props>) {
|
||||||
const { embed } = this.props;
|
const { embed } = component.props;
|
||||||
if (!embed?.dearrow) return null;
|
if (!embed?.dearrow) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -97,7 +97,7 @@ function renderButton(this: Component<Props>) {
|
||||||
embed.thumbnail.proxyURL = oldThumb;
|
embed.thumbnail.proxyURL = oldThumb;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.forceUpdate();
|
component.forceUpdate();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* Dearrow Icon, taken from https://dearrow.ajay.app/logo.svg (and optimised) */}
|
{/* Dearrow Icon, taken from https://dearrow.ajay.app/logo.svg (and optimised) */}
|
||||||
|
@ -134,7 +134,13 @@ export default definePlugin({
|
||||||
authors: [Devs.Ven],
|
authors: [Devs.Ven],
|
||||||
|
|
||||||
embedDidMount,
|
embedDidMount,
|
||||||
renderButton: ErrorBoundary.wrap(renderButton, { noop: true }),
|
renderButton(component: Component<Props>) {
|
||||||
|
return (
|
||||||
|
<ErrorBoundary noop>
|
||||||
|
{renderButton(component)}
|
||||||
|
</ErrorBoundary>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
patches: [{
|
patches: [{
|
||||||
find: "this.renderInlineMediaEmbed",
|
find: "this.renderInlineMediaEmbed",
|
||||||
|
@ -148,7 +154,7 @@ export default definePlugin({
|
||||||
// add dearrow button
|
// add dearrow button
|
||||||
{
|
{
|
||||||
match: /children:\[(?=null!=\i\?\i\.renderSuppressButton)/,
|
match: /children:\[(?=null!=\i\?\i\.renderSuppressButton)/,
|
||||||
replace: "children:[$self.renderButton.call(this),"
|
replace: "children:[$self.renderButton(this),"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
Loading…
Reference in a new issue