Update ClickableMentions.plugin.js

This commit is contained in:
Mirco Wittrien 2022-09-10 15:06:40 +02:00
parent 1d260bff2e
commit 6f111e40f6
1 changed files with 19 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* @name ClickableMentions
* @author DevilBro
* @authorId 278543574059057154
* @version 1.0.4
* @version 1.0.5
* @description Allows you to open a User Popout by clicking a Mention in your Message Input
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -59,9 +59,13 @@ module.exports = (_ => {
return class ClickableMentions extends Plugin {
onLoad () {
this.patchedModules = {
before: {
RoleMention: "default"
},
after: {
RichUserMention: "UserMention",
RichRoleMention: "RoleMention"
RichRoleMention: "RoleMention",
RoleMention: "default"
}
};
@ -95,7 +99,7 @@ module.exports = (_ => {
channelId = BDFDB.LibraryModules.GuildChannelStore.getSelectableChannelIds(guild.id).indexOf(currentChannelId) > -1 ? currentChannelId : BDFDB.LibraryModules.GuildChannelStore.getDefaultChannel(guild.id).id;
}
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.RoleMention, {
type: "mention",
type: "mention_textarea",
children: [`@${guild.roles[e.instance.props.id].name}`],
content: [
{type: "text", content: `@${guild.roles[e.instance.props.id].name}`}
@ -108,6 +112,18 @@ module.exports = (_ => {
});
}
}
processRoleMention (e) {
if (!e.returnvalue) {
if (e.instance.props.type == "mention_textarea") {
e.instance.props.type = "mention";
e.instance.props.place = "textarea";
}
}
else if (e.instance.props.place == "textarea") {
e.returnvalue.props.align = BDFDB.LibraryComponents.PopoutContainer.Align.BOTTOM;
}
}
};
})(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
})();