mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-17 02:16:54 +00:00
4.18.7
* Fixed: Clicking emotes in the FFZ Emote Menu. (Broken by a Twitch update.)
This commit is contained in:
parent
aedfcecc14
commit
40cae9f115
6 changed files with 57 additions and 7 deletions
|
@ -621,7 +621,9 @@ export default class ChatHook extends Module {
|
|||
|
||||
onEnable() {
|
||||
this.on('site.web_munch:loaded', this.grabTypes);
|
||||
this.on('site.web_munch:loaded', this.defineClasses);
|
||||
this.grabTypes();
|
||||
this.defineClasses();
|
||||
|
||||
this.chat.context.on('changed:chat.points.show-callouts', () => {
|
||||
this.InlineCallout.forceUpdate();
|
||||
|
@ -974,8 +976,29 @@ export default class ChatHook extends Module {
|
|||
|
||||
this.ChatContainer.ready((cls, instances) => {
|
||||
const t = this,
|
||||
old_render = cls.prototype.render,
|
||||
old_catch = cls.prototype.componentDidCatch;
|
||||
|
||||
cls.prototype.render = function() {
|
||||
//try {
|
||||
if ( t.CommunityStackHandler ) {
|
||||
const React = t.web_munch.getModule('react'),
|
||||
out = old_render.call(this),
|
||||
thing = out?.props?.children?.props?.children;
|
||||
|
||||
if ( React && Array.isArray(thing) )
|
||||
thing.push(React.createElement(t.CommunityStackHandler));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/*} catch(err) {
|
||||
// No op
|
||||
}*/
|
||||
|
||||
return old_render.call(this);
|
||||
}
|
||||
|
||||
// Try catching errors. With any luck, maybe we can
|
||||
// recover from the error when we re-build?
|
||||
cls.prototype.componentDidCatch = function(err, info) {
|
||||
|
@ -1006,6 +1029,32 @@ export default class ChatHook extends Module {
|
|||
}
|
||||
|
||||
|
||||
defineClasses() {
|
||||
if ( this.CommunityStackHandler )
|
||||
return true;
|
||||
|
||||
const t = this,
|
||||
React = this.web_munch.getModule('react'),
|
||||
Stack = this.web_munch.getModule('highlightstack'),
|
||||
createElement = React && React.createElement;
|
||||
|
||||
if ( ! createElement || ! Stack || ! Stack.b )
|
||||
return false;
|
||||
|
||||
this.CommunityStackHandler = function() {
|
||||
const stack = React.useContext(Stack.b),
|
||||
dispatch = React.useContext(Stack.c);
|
||||
|
||||
t.community_stack = stack;
|
||||
t.community_dispatch = dispatch;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
this.ChatContainer.forceUpdate();
|
||||
}
|
||||
|
||||
|
||||
updatePinnedCallouts() {
|
||||
for(const inst of this.PinnedCallout.instances)
|
||||
this.onPinnedCallout(inst);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue