This commit is contained in:
Mirco Wittrien 2019-12-10 13:59:44 +01:00
parent 8e94b8d8fa
commit 5761460e31
7 changed files with 119 additions and 130 deletions

View File

@ -16,8 +16,7 @@ class ChatAliases {
this.patchedModules = {
after: {
"ChannelTextArea":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
ChannelTextArea: "componentDidMount"
}
};
}
@ -293,46 +292,44 @@ class ChatAliases {
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props.value && instance.props.value.trim()) {
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, instance.props.value.trim());
}
}
onMessageContextMenu (instance, menu, returnvalue) {
if (instance.props.message && instance.props.channel && instance.props.target) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, text);
}
}
appendItem (menu, returnvalue, text) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Add to ChatAliases",
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
this.openAddModal(text);
}
})
]
});
if (index > -1) children.splice(index, 0, itemgroup);
else children.push(itemgroup);
}
processStandardSidebarView (instance, wrapper, returnvalue) {
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.ModuleUtils.forceAllUpdates(this);
}
}
processChannelTextArea (instance, wrapper, returnvalue) {
if (instance.props.channel && instance.props.type) {
var textarea = wrapper.querySelector("textarea");
onNativeContextMenu (e) {
if (e.instance.props.value && e.instance.props.value.trim()) {
if ((e.instance.props.type == "NATIVE_TEXT" || e.instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(e, e.instance.props.value.trim());
}
}
onMessageContextMenu (e) {
if (e.instance.props.message && e.instance.props.channel && e.instance.props.target) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(e, text);
}
}
appendItem (e, text) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Add to ChatAliases",
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openAddModal(text);
}
})
]
}));
}
processChannelTextArea (e) {
if (e.instance.props.channel && e.instance.props.type) {
var textarea = e.node.querySelector("textarea");
if (!textarea) return;
let settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.ListenerUtils.add(this, textarea, "input", () => {
@ -347,44 +344,44 @@ class ChatAliases {
if (messageInput.text != null) {
document.execCommand("insertText", false, messageInput.text ? messageInput.text + " " : "");
}
if (messageInput.files.length > 0 && (instance.props.channel.type == 1 || BDFDB.UserUtils.can("ATTACH_FILES"))) {
BDFDB.LibraryModules.UploadUtils.instantBatchUpload(instance.props.channel.id, messageInput.files);
if (messageInput.files.length > 0 && (e.instance.props.channel.type == 1 || BDFDB.UserUtils.can("ATTACH_FILES"))) {
BDFDB.LibraryModules.UploadUtils.instantBatchUpload(e.instance.props.channel.id, messageInput.files);
}
}
}
}
});
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
BDFDB.ListenerUtils.add(this, textarea, "keydown", event => {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
if (autocompletemenu && (event.which == 9 || event.which == 13)) {
if (BDFDB.DOMUtils.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteAliasesRow")) {
BDFDB.ListenerUtils.stopEvent(e);
BDFDB.ListenerUtils.stopEvent(event);
this.swapWordWithAlias(textarea);
}
}
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
else if (autocompletemenu && (event.which == 38 || event.which == 40)) {
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteAliasesSelector)");
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
if (BDFDB.DOMUtils.containsClass(selected, "autocompleteAliasesSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
BDFDB.ListenerUtils.stopEvent(e);
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
if (BDFDB.DOMUtils.containsClass(selected, "autocompleteAliasesSelector") || autocompleteitems[event.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
BDFDB.ListenerUtils.stopEvent(event);
let next = this.getNextSelection(autocompletemenu, null, event.which == 38 ? false : true);
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.DOMUtils.addClass(next, BDFDB.disCN.autocompleteselected);
}
}
else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
else if (textarea.value && !event.shiftKey && event.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
this.format = true;
textarea.dispatchEvent(new Event("input"));
}
else if (!e.ctrlKey && e.which != 16 && settings.addAutoComplete && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) {
else if (!event.ctrlKey && event.which != 16 && settings.addAutoComplete && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) {
BDFDB.TimeUtils.clear(textarea.ChatAliasAutocompleteTimeout);
textarea.ChatAliasAutocompleteTimeout = BDFDB.TimeUtils.timeout(() => {this.addAutoCompleteMenu(textarea);},100);
}
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.DOMUtils.remove(".autocompleteAliases", ".autocompleteAliasesRow");
if (!event.ctrlKey && event.which != 38 && event.which != 40 && !(event.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.DOMUtils.remove(".autocompleteAliases", ".autocompleteAliasesRow");
});
BDFDB.ListenerUtils.add(this, textarea, "click", e => {
BDFDB.ListenerUtils.add(this, textarea, "click", _ => {
if (settings.addAutoComplete && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) BDFDB.TimeUtils.timeout(() => {this.addAutoCompleteMenu(textarea);});
});
}
@ -430,17 +427,17 @@ class ChatAliases {
}
let autocompleterowheader = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">Aliases: <strong class="lastword">${BDFDB.StringUtils.htmlEscape(lastword)}</strong></div></div></div>`);
autocompletemenu.appendChild(autocompleterowheader);
BDFDB.ListenerUtils.add(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
BDFDB.ListenerUtils.add(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, event => {
var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.DOMUtils.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
BDFDB.DOMUtils.addClass(event.currentTarget, BDFDB.disCN.autocompleteselected);
});
for (let word in matchedaliases) {
if (amount-- < 1) break;
let autocompleterow = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteAliasesRow"><div class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteAliasesSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.flexchild} aliasword" style="flex: 1 1 auto;">${BDFDB.StringUtils.htmlEscape(word)}</div><div class="${BDFDB.disCNS.autocompletedescription + BDFDB.disCN.flexchild}">${BDFDB.StringUtils.htmlEscape(matchedaliases[word].replace)}</div></div></div></div>`);
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithAlias(textarea);});
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", _ => {this.swapWordWithAlias(textarea);});
autocompletemenu.appendChild(autocompleterow);
}
if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {

View File

@ -285,41 +285,7 @@ class ChatFilter {
BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo");
}
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props.value && instance.props.value.trim()) {
if ((instance.props.type == "NATIVE_TEXT" || instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, instance.props.value.trim());
}
}
onMessageContextMenu (instance, menu, returnvalue) {
if (instance.props.message && instance.props.channel && instance.props.target) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(menu, returnvalue, text);
}
}
appendItem (menu, returnvalue, text) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Add to ChatFilter",
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
this.openAddModal(text);
}
})
]
});
if (index > -1) children.splice(index, 0, itemgroup);
else children.push(itemgroup);
}
processMessage (instance, wrapper, returnvalue) {
wrapper.querySelectorAll(`${BDFDB.dotCNC.messagemarkup + BDFDB.dotCN.messageaccessory}`).forEach(message => {this.hideMessage(message);});
}
processStandardSidebarView (instance, wrapper, returnvalue) {
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
document.querySelectorAll(`${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored, ${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored`).forEach(message => {this.resetMessage(message);});
@ -327,6 +293,38 @@ class ChatFilter {
}
}
onNativeContextMenu (e) {
if (e.instance.props.value && e.instance.props.value.trim()) {
if ((e.instance.props.type == "NATIVE_TEXT" || e.instance.props.type == "CHANNEL_TEXT_AREA") && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(e, e.instance.props.value.trim());
}
}
onMessageContextMenu (e) {
if (e.instance.props.message && e.instance.props.channel && e.instance.props.target) {
let text = document.getSelection().toString().trim();
if (text && BDFDB.DataUtils.get(this, "settings", "addContextMenu")) this.appendItem(e, text);
}
}
appendItem (e, text) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Add to ChatFilter",
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openAddModal(text);
}
})
]
}));
}
processMessage (e) {
e.node.querySelectorAll(`${BDFDB.dotCNC.messagemarkup + BDFDB.dotCN.messageaccessory}`).forEach(message => {this.hideMessage(message);});
}
hideMessage (message) {
if (message.tagName && !BDFDB.DOMUtils.containsClass(message, "blocked", "censored", false)) {
var orightml = message.innerHTML;

View File

@ -143,9 +143,9 @@ class EditChannels {
// begin of own functions
onChannelContextMenu (instance, menu, returnvalue) {
if (instance.props.channel && !BDFDB.DOMUtils.getParent(".container-hidden", instance.props.target) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
onChannelContextMenu (e) {
if (e.instance.props.channel && !BDFDB.DOMUtils.getParent(".container-hidden", e.instance.props.target)) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
@ -155,16 +155,16 @@ class EditChannels {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_channelsettings_text,
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
this.showChannelSettings(instance.props.channel);
BDFDB.ContextMenuUtils.close(e.instance);
this.showChannelSettings(e.instance.props.channel);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_resetsettings_text,
disabled: !BDFDB.DataUtils.load(this, "channels", instance.props.channel.id),
disabled: !BDFDB.DataUtils.load(this, "channels", e.instance.props.channel.id),
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
BDFDB.DataUtils.remove(this, "channels", instance.props.channel.id);
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.forceUpdateAll();
}
})

View File

@ -190,10 +190,10 @@ class EditUsers {
// begin of own functions
onUserContextMenu (instance, menu, returnvalue) {
if (instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
onUserContextMenu (e) {
if (e.instance.props.user) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_localusersettings_text,
@ -202,16 +202,16 @@ class EditUsers {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_usersettings_text,
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
this.showUserSettings(instance.props.user);
BDFDB.ContextMenuUtils.close(e.instance);
this.showUserSettings(e.instance.props.user);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_resetsettings_text,
disabled: !BDFDB.DataUtils.load(this, "users", instance.props.user.id),
disabled: !BDFDB.DataUtils.load(this, "users", e.instance.props.user.id),
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
BDFDB.DataUtils.remove(this, "users", instance.props.user.id);
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DataUtils.remove(this, "users", e.instance.props.user.id);
this.forceUpdateAll();
}
})
@ -219,9 +219,7 @@ class EditUsers {
})]
})
]
});
if (index > -1) children.splice(index, 0, itemgroup);
else children.push(itemgroup);
}));
}
}

View File

@ -339,16 +339,15 @@ class PluginRepo {
// begin of own functions
onUserSettingsCogContextMenu (instance, menu, returnvalue) {
BDFDB.TimeUtils.timeout(() => {for (let child of returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
const repoItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
onUserSettingsCogContextMenu (e) {
BDFDB.TimeUtils.timeout(_ => {for (let child of e.returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
child.props.render.push(repoItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Plugin Repo",
action: _ => {
if (!this.loading.is) BDFDB.ContextMenuUtils.close(menu);
if (!this.loading.is) BDFDB.ContextMenuUtils.close(e.instance);
this.openPluginRepoModal();
}
});
child.props.render.push(repoItem);
}));
break;
}});
}

View File

@ -144,11 +144,11 @@ class SpellCheck {
// begin of own functions
onNativeContextMenu (instance, menu, returnvalue) {
if (instance.props.target && instance.props.target.tagName == "TEXTAREA") {
let [SCparent, SCindex] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["NativeSpellcheckGroup", "FluxContainer(NativeSpellcheckGroup)"]});
onNativeContextMenu (e) {
if (e.instance.props.target && e.instance.props.target.tagName == "TEXTAREA") {
let [SCparent, SCindex] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["NativeSpellcheckGroup", "FluxContainer(NativeSpellcheckGroup)"]});
if (SCindex > -1) {
if (BDFDB.ReactUtils.findValue(instance._reactInternalFiber, "spellcheckEnabled") == true) {
if (BDFDB.ReactUtils.findValue(e.instance._reactInternalFiber, "spellcheckEnabled") == true) {
BDFDB.TimeUtils.clear(this.disableSpellcheckTimeout);
this.disableSpellcheckTimeout = BDFDB.TimeUtils.timeout(() => {
BDFDB.LibraryModules.SpellCheckUtils.toggleSpellcheck();
@ -157,7 +157,7 @@ class SpellCheck {
}
SCparent.splice(SCindex, 1);
}
let textarea = instance.props.target, word = null, length = 0;
let textarea = e.instance.props.target, word = null, length = 0;
if (textarea.value && (textarea.selectionStart || textarea.selectionEnd)) for (let splitword of textarea.value.split(/\s/g)) {
length += splitword.length + 1;
if (length > textarea.selectionStart) {
@ -173,7 +173,7 @@ class SpellCheck {
}
}
if (word && this.isWordNotInDictionary(word)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
let items = [];
let similarWords = this.getSimilarWords(word.toLowerCase().trim());
for (let suggestion of similarWords.sort()) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
@ -187,7 +187,7 @@ class SpellCheck {
label: this.labels.similarwordssubmenu_none_text,
disabled: true
}));
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: BDFDB.LanguageUtils.LanguageStrings.SPELLCHECK,
render: [
@ -195,7 +195,7 @@ class SpellCheck {
label: this.labels.context_spellcheck_text,
hint: word,
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
BDFDB.ContextMenuUtils.close(e.instance);
this.addToOwnDictionary(word);
}
}),
@ -205,9 +205,7 @@ class SpellCheck {
})
]
})
});
if (index > -1) children.splice(index, 0, itemgroup);
else children.push(itemgroup);
}));
}
}
}

View File

@ -399,16 +399,15 @@ class ThemeRepo {
// begin of own functions
onUserSettingsCogContextMenu (instance, menu, returnvalue) {
BDFDB.TimeUtils.timeout(() => {for (let child of returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
const repoItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
onUserSettingsCogContextMenu (e) {
BDFDB.TimeUtils.timeout(_ => {for (let child of e.returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
child.props.render.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Theme Repo",
action: _ => {
if (!this.loading.is) BDFDB.ContextMenuUtils.close(menu);
if (!this.loading.is) BDFDB.ContextMenuUtils.close(e.instance);
this.openThemeRepoModal();
}
});
child.props.render.push(repoItem);
}));
break;
}});
}