Update EditRoles.plugin.js
This commit is contained in:
parent
b031394cf4
commit
090b2ad441
|
@ -2,7 +2,7 @@
|
||||||
* @name EditRoles
|
* @name EditRoles
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.0.1
|
* @version 1.0.3
|
||||||
* @description Allows you to locally edit Roles
|
* @description Allows you to locally edit Roles
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "EditRoles",
|
"name": "EditRoles",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"description": "Allows you to locally edit Roles"
|
"description": "Allows you to locally edit Roles"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -135,6 +135,25 @@ module.exports = (_ => {
|
||||||
BDFDB.MessageUtils.rerenderAll();
|
BDFDB.MessageUtils.rerenderAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUserContextMenu (e) {
|
||||||
|
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "roles"});
|
||||||
|
if (index > -1 && children[index].props && BDFDB.ArrayUtils.is(children[index].props.children)) for (let child of children[index].props.children) {
|
||||||
|
if (child && child.props && typeof child.props.label == "function") {
|
||||||
|
let renderLabel = child.props.label;
|
||||||
|
child.props.label = (...args) => {
|
||||||
|
let label = renderLabel(...args);
|
||||||
|
let onContextMenu = typeof label.props.onContextMenu == "function" ? label.props.onContextMenu : (_ => {});
|
||||||
|
label.props.onContextMenu = event => {
|
||||||
|
BDFDB.LibraryModules.ContextMenuUtils.openContextMenu(event, function (e) {
|
||||||
|
return BDFDB.ReactUtils.createElement(BDFDB.ModuleUtils.findByName("DeveloperContextMenu"), Object.assign({}, e, {id: child.props.id}));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return label;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onGuildContextMenu (e) {
|
onGuildContextMenu (e) {
|
||||||
if (e.instance.props.guild) e.instance.props.guild = this.changeRolesInGuild(e.instance.props.guild);
|
if (e.instance.props.guild) e.instance.props.guild = this.changeRolesInGuild(e.instance.props.guild);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue