Revert "Update EditChannels.plugin.js"

This reverts commit 4b57277dbf.
This commit is contained in:
Mirco Wittrien 2022-07-08 16:07:07 +02:00
parent 4b57277dbf
commit 376d7c451e
1 changed files with 36 additions and 37 deletions

View File

@ -2,7 +2,7 @@
* @name EditChannels * @name EditChannels
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 4.3.9 * @version 4.3.8
* @description Allows you to locally edit Channels * @description Allows you to locally edit Channels
* @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": "EditChannels", "name": "EditChannels",
"author": "DevilBro", "author": "DevilBro",
"version": "4.3.9", "version": "4.3.8",
"description": "Allows you to locally edit Channels" "description": "Allows you to locally edit Channels"
} }
}; };
@ -222,23 +222,18 @@ module.exports = (_ => {
} }
onChannelContextMenu (e) { onChannelContextMenu (e) {
if (e.instance.props.channel && e.subType == "useChannelDeleteItem") { this.injectItem(e);
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.push(this.createMenuItem(e.instance.props.channel));
}
} }
onGroupDMContextMenu (e) { onGroupDMContextMenu (e) {
this.injectItem(e);
}
injectItem (e) {
if (e.instance.props.channel) { if (e.instance.props.channel) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true}); let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: this.createMenuItem(e.instance.props.channel) children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
}));
}
}
createMenuItem (channel) {
return BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localchannelsettings, label: this.labels.context_localchannelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
@ -246,16 +241,18 @@ module.exports = (_ => {
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_channelsettings, label: this.labels.submenu_channelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => this.openChannelSettingsModal(channel) action: _ => {
this.openChannelSettingsModal(e.instance.props.channel);
}
}), }),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings, label: this.labels.submenu_resetsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER, color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
disabled: !changedChannels[channel.id], disabled: !changedChannels[e.instance.props.channel.id],
action: event => { action: event => {
let remove = _ => { let remove = _ => {
BDFDB.DataUtils.remove(this, "channels", channel.id); BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.forceUpdateAll(true); this.forceUpdateAll(true);
}; };
if (event.shiftKey) remove(); if (event.shiftKey) remove();
@ -264,7 +261,9 @@ module.exports = (_ => {
}) })
] ]
}) })
}); })
}));
}
} }
processChannelEditorContainer (e) { processChannelEditorContainer (e) {