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