stuff
This commit is contained in:
parent
36fa5177b1
commit
05671871db
|
@ -2,7 +2,7 @@
|
||||||
* @name ClickableMentions
|
* @name ClickableMentions
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.0.5
|
* @version 1.0.6
|
||||||
* @description Allows you to open a User Popout by clicking a Mention in your Message Input
|
* @description Allows you to open a User Popout by clicking a Mention in your Message Input
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -58,15 +58,10 @@ module.exports = (_ => {
|
||||||
} : (([Plugin, BDFDB]) => {
|
} : (([Plugin, BDFDB]) => {
|
||||||
return class ClickableMentions extends Plugin {
|
return class ClickableMentions extends Plugin {
|
||||||
onLoad () {
|
onLoad () {
|
||||||
this.patchedModules = {
|
this.modulePatches = {
|
||||||
before: {
|
after: [
|
||||||
RoleMention: "default"
|
"RichUserMention"
|
||||||
},
|
]
|
||||||
after: {
|
|
||||||
RichUserMention: "UserMention",
|
|
||||||
RichRoleMention: "RoleMention",
|
|
||||||
RoleMention: "default"
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchPriority = 9;
|
this.patchPriority = 9;
|
||||||
|
@ -81,48 +76,15 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
processRichUserMention (e) {
|
processRichUserMention (e) {
|
||||||
if (e.instance.props.id && BDFDB.LibraryStores.UserStore.getUser(e.instance.props.id)) return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.UserMention, {
|
if (!e.instance.props.id || !BDFDB.LibraryStores.UserStore.getUser(e.instance.props.id) || typeof e.returnvalue.props.children != "function") return;
|
||||||
className: "mention",
|
let childrenRender = e.returnvalue.props.children;
|
||||||
|
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.UserPopoutContainer, Object.assign({}, e.instance.props, {
|
||||||
|
killEvent: true,
|
||||||
userId: e.instance.props.id,
|
userId: e.instance.props.id,
|
||||||
channelId: e.instance.props.channelId,
|
position: BDFDB.LibraryComponents.PopoutContainer.Positions.RIGHT,
|
||||||
guildId: e.instance.props.guildId,
|
align: BDFDB.LibraryComponents.PopoutContainer.Align.BOTTOM,
|
||||||
inlinePreview: false
|
children: childrenRender(...args)
|
||||||
});
|
})), "Error in Children Render of RichUserMention", this);
|
||||||
}
|
|
||||||
|
|
||||||
processRichRoleMention (e) {
|
|
||||||
if (e.instance.props.id && e.instance.props.guildId && e.instance.props.id != e.instance.props.guildId) {
|
|
||||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(e.instance.props.guildId);
|
|
||||||
let channelId = e.instance.props.channelId;
|
|
||||||
if (!channelId) {
|
|
||||||
let currentChannelId = BDFDB.LibraryStores.SelectedChannelStore.getChannelId();
|
|
||||||
channelId = BDFDB.LibraryStores.GuildChannelStore.getSelectableChannelIds(guild.id).indexOf(currentChannelId) > -1 ? currentChannelId : BDFDB.LibraryStores.GuildChannelStore.getDefaultChannel(guild.id).id;
|
|
||||||
}
|
|
||||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.RoleMention, {
|
|
||||||
type: "mention_textarea",
|
|
||||||
children: [`@${guild.roles[e.instance.props.id].name}`],
|
|
||||||
content: [
|
|
||||||
{type: "text", content: `@${guild.roles[e.instance.props.id].name}`}
|
|
||||||
],
|
|
||||||
roleColor: guild.roles[e.instance.props.id].color,
|
|
||||||
roleId: e.instance.props.id,
|
|
||||||
channelId: channelId,
|
|
||||||
guildId: e.instance.props.guildId,
|
|
||||||
inlinePreview: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
})(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="black" d="M 0,1.091 V 4.3636999 H 6.5454546 V 22.909 H 9.818182 V 4.3636999 h 6.545455 V 1.091 Z M 12,8.7272994 V 12 h 4.363637 v 10.909 h 3.272726 V 12 H 24 V 8.7272994 Z"/></svg>
|
After Width: | Height: | Size: 275 B |
Loading…
Reference in New Issue