This commit is contained in:
Mirco Wittrien 2020-08-04 16:05:52 +02:00
parent 1cb4c41c19
commit b6ea53b932
23 changed files with 2234 additions and 2200 deletions

View File

@ -3528,13 +3528,14 @@
BDFDB.ContextMenuUtils.createItem = function (component, props = {}) { BDFDB.ContextMenuUtils.createItem = function (component, props = {}) {
if (!component) return null; if (!component) return null;
else { else {
if (props.persisting || (typeof props.color == "string" && !BDFDB.DiscordClasses[`menu${props.color.toLowerCase()}`])) component = InternalComponents.MenuItem;
if (BDFDB.ObjectUtils.toArray(RealMenuItems).some(c => c == component)) return BDFDB.ReactUtils.createElement(component, props); if (BDFDB.ObjectUtils.toArray(RealMenuItems).some(c => c == component)) return BDFDB.ReactUtils.createElement(component, props);
else return BDFDB.ReactUtils.createElement(RealMenuItems.MenuItem, { else return BDFDB.ReactUtils.createElement(RealMenuItems.MenuItem, {
id: props.id, id: props.id,
disabled: props.disabled, disabled: props.disabled,
render: menuItemProps => { render: menuItemProps => {
if (!props.state) props.state = BDFDB.ObjectUtils.extract(props, "checked", "value"); if (!props.state) props.state = BDFDB.ObjectUtils.extract(props, "checked", "value");
return BDFDB.ReactUtils.createElement(component, Object.assign(props, menuItemProps)); return BDFDB.ReactUtils.createElement(component, Object.assign(props, menuItemProps, {color: props.color}));
} }
}); });
} }
@ -4174,6 +4175,7 @@
paginationListPagination: "pagination-ko4zZk", paginationListPagination: "pagination-ko4zZk",
popoutWrapper: "popout-xwjvsX", popoutWrapper: "popout-xwjvsX",
quickSelectWrapper: "quickSelectWrapper-UCfTKz", quickSelectWrapper: "quickSelectWrapper-UCfTKz",
menuColorCustom: "colorCustom-44asd2",
menuItemHint: "hint-BK71lM", menuItemHint: "hint-BK71lM",
modalHeaderShade: "shade-h6F4sT", modalHeaderShade: "shade-h6F4sT",
modalHeaderHasSibling: "hasSiblings-fRyjyl", modalHeaderHasSibling: "hasSiblings-fRyjyl",
@ -4571,6 +4573,7 @@
DiscordClassModules.LoadingScreen = BDFDB.ModuleUtils.findByProperties("container", "problemsText", "problems"); DiscordClassModules.LoadingScreen = BDFDB.ModuleUtils.findByProperties("container", "problemsText", "problems");
DiscordClassModules.Margins = BDFDB.ModuleUtils.findByProperties("marginBottom4", "marginCenterHorz"); DiscordClassModules.Margins = BDFDB.ModuleUtils.findByProperties("marginBottom4", "marginCenterHorz");
DiscordClassModules.Menu = BDFDB.ModuleUtils.findByProperties("menu", "styleFlexible", "item"); DiscordClassModules.Menu = BDFDB.ModuleUtils.findByProperties("menu", "styleFlexible", "item");
DiscordClassModules.MenuCaret = BDFDB.ModuleUtils.findByProperties("arrow", "open");
DiscordClassModules.MenuReactButton = BDFDB.ModuleUtils.findByProperties("wrapper", "icon", "focused"); DiscordClassModules.MenuReactButton = BDFDB.ModuleUtils.findByProperties("wrapper", "icon", "focused");
DiscordClassModules.MenuSlider = BDFDB.ModuleUtils.findByProperties("slider", "sliderContainer"); DiscordClassModules.MenuSlider = BDFDB.ModuleUtils.findByProperties("slider", "sliderContainer");
DiscordClassModules.Member = BDFDB.ModuleUtils.findByProperties("member", "ownerIcon"); DiscordClassModules.Member = BDFDB.ModuleUtils.findByProperties("member", "ownerIcon");
@ -5527,9 +5530,12 @@
mentionwrapper: ["NotFound", "mentionWrapper"], mentionwrapper: ["NotFound", "mentionWrapper"],
menu: ["Menu", "menu"], menu: ["Menu", "menu"],
menucaret: ["Menu", "caret"], menucaret: ["Menu", "caret"],
menucaretarrow: ["MenuCaret", "arrow"],
menucaretopen: ["MenuCaret", "open"],
menucheck: ["Menu", "check"], menucheck: ["Menu", "check"],
menucheckbox: ["Menu", "checkbox"], menucheckbox: ["Menu", "checkbox"],
menucolorbrand: ["Menu", "colorBrand"], menucolorbrand: ["Menu", "colorBrand"],
menucolorcustom: ["BDFDB", "menuColorCustom"],
menucolordanger: ["Menu", "colorDanger"], menucolordanger: ["Menu", "colorDanger"],
menucolordefault: ["Menu", "colorDefault"], menucolordefault: ["Menu", "colorDefault"],
menucolorpremium: ["Menu", "colorPremium"], menucolorpremium: ["Menu", "colorPremium"],
@ -6912,6 +6918,69 @@
var InternalComponents = {NativeSubComponents: {}, LibraryComponents: {}}, reactInitialized = LibraryModules.React && LibraryModules.React.Component; var InternalComponents = {NativeSubComponents: {}, LibraryComponents: {}}, reactInitialized = LibraryModules.React && LibraryModules.React.Component;
InternalComponents.MenuItem = reactInitialized && class BDFDB_MenuItem extends LibraryModules.React.Component {
render() {
let color = (typeof this.props.color == "string" ? this.props.color : InternalComponents.LibraryComponents.MenuItems.Colors.DEFAULT).toLowerCase();
let isCustomColor = false;
if (color) {
if (!BDFDB.DiscordClasses[`menu${color}`] && BDFDB.ColorUtils.getType(color)) {
isCustomColor = true;
color = BDFDB.ColorUtils.convert(color, "RGBA");
}
else color = (InternalComponents.LibraryComponents.MenuItems.Colors.DEFAULT || "").toLowerCase();
}
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, Object.assign({
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.menuitem, BDFDB.disCN.menulabelcontainer, color && (isCustomColor ? BDFDB.disCN.menucolorcustom : BDFDB.disCN[`menu${color}`]), this.props.disabled && BDFDB.disCN.menudisabled, this.props.isFocused && BDFDB.disCN.menufocused),
style: {
color: isCustomColor && (!this.props.isFocused ? color : (BDFDB.ColorUtils.isBright(color) ? "#000" : "#FFF")),
background: isCustomColor && this.props.isFocused && color
},
onClick: this.props.disabled ? null : e => {
if (!this.props.action) return false;
!this.props.persisting && this.props.onClose();
this.props.action(e, this);
},
"aria-disabled": this.props.disabled,
children: [
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menulabel,
children: [
typeof this.props.label == "function" ? this.props.label(this) : this.props.label,
this.props.subtext && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menusubtext,
children: typeof this.props.subtext == "function" ? this.props.subtext(this) : this.props.subtext
})
].filter(n => n)
}),
this.props.hint && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuhintcontainer,
children: typeof this.props.hint == "function" ? this.props.hint(this) : this.props.hint
}),
this.props.icon && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuiconcontainer,
children: BDFDB.ReactUtils.createElement(this.props.icon, {
className: BDFDB.disCN.menuicon,
})
}),
this.props.imageUrl && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuimagecontainer,
children: BDFDB.ReactUtils.createElement("img", {
className: BDFDB.disCN.menuimage,
src: typeof this.props.imageUrl == "function" ? this.props.imageUrl(this) : this.props.imageUrl,
alt: ""
})
}),
this.props.hasSubmenu && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuiconcontainer,
children: BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menucaret,
name: InternalComponents.LibraryComponents.SvgIcon.Names.MENU_CARET
})
})
].filter(n => n)
}, this.props.menuItemProps));
}
};
InternalComponents.ErrorBoundary = reactInitialized && class BDFDB_ErrorBoundary extends LibraryModules.React.PureComponent { InternalComponents.ErrorBoundary = reactInitialized && class BDFDB_ErrorBoundary extends LibraryModules.React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
@ -8217,12 +8286,6 @@
} }
}; };
InternalComponents.LibraryComponents.MenuItems.MenuPersistingItem = InternalBDFDB.loadPatchedComp("MenuItems.MenuPersistingItem") || reactInitialized && class BDFDB_MenuPersistingItem extends LibraryModules.React.Component {
render() {
return BDFDB.ReactUtils.createElement(InternalComponents.NativeSubComponents.MenuItem, Object.assign({}, this.props, {onClose: _ => {}}));
}
};
InternalComponents.LibraryComponents.MenuItems.MenuSliderItem = InternalBDFDB.loadPatchedComp("MenuItems.MenuSliderItem") || reactInitialized && class BDFDB_MenuSliderItem extends LibraryModules.React.Component { InternalComponents.LibraryComponents.MenuItems.MenuSliderItem = InternalBDFDB.loadPatchedComp("MenuItems.MenuSliderItem") || reactInitialized && class BDFDB_MenuSliderItem extends LibraryModules.React.Component {
handleValueChange(value) { handleValueChange(value) {
if (this.props.state) { if (this.props.state) {
@ -8394,7 +8457,7 @@
if (!this.props.alphabetKey) items = this.props.items; if (!this.props.alphabetKey) items = this.props.items;
else { else {
let unsortedItems = [].concat(this.props.items); let unsortedItems = [].concat(this.props.items);
for (let key of ["0-9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]) { for (let key of ["0-9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]) {
let numbers = key == "0-9", alphaItems = []; let numbers = key == "0-9", alphaItems = [];
for (let item of unsortedItems) if (item && item[this.props.alphabetKey] && (numbers && !isNaN(parseInt(item[this.props.alphabetKey][0])) || item[this.props.alphabetKey].toUpperCase().indexOf(key) == 0)) alphaItems.push(item); for (let item of unsortedItems) if (item && item[this.props.alphabetKey] && (numbers && !isNaN(parseInt(item[this.props.alphabetKey][0])) || item[this.props.alphabetKey].toUpperCase().indexOf(key) == 0)) alphaItems.push(item);
for (let sortedItem of alphaItems) BDFDB.ArrayUtils.remove(unsortedItems, sortedItem); for (let sortedItem of alphaItems) BDFDB.ArrayUtils.remove(unsortedItems, sortedItem);
@ -8545,7 +8608,6 @@
label: option.label, label: option.label,
id: BDFDB.ContextMenuUtils.createItemId("option", option.key || option.value || i), id: BDFDB.ContextMenuUtils.createItemId("option", option.key || option.value || i),
action: selected ? null : event2 => { action: selected ? null : event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
this.handleChange.bind(this)(option) this.handleChange.bind(this)(option)
} }
}) })
@ -9025,7 +9087,9 @@
width: 24, width: 24,
height: 24, height: 24,
color: "currentColor" color: "currentColor"
}, this.props.name.defaultProps, this.props); }, this.props.name.defaultProps, this.props, {
className: BDFDB.DOMUtils.formatClassName(typeof this.props.name.getClassName == "function" && this.props.name.getClassName(this.props), this.props.className)
});
for (let key in props) this.props.iconSVG = this.props.iconSVG.replace(new RegExp(`%%${key}`, "g"), props[key]); for (let key in props) this.props.iconSVG = this.props.iconSVG.replace(new RegExp(`%%${key}`, "g"), props[key]);
} }
if (this.props.iconSVG) { if (this.props.iconSVG) {
@ -9114,6 +9178,10 @@
LOCK_CLOSED: { LOCK_CLOSED: {
icon: `<svg name="LockClosed" aria-hidden="false" width="%%width" height="%%height" viewBox="0 0 24 24"><path fill="%%color" d="M17 11V7C17 4.243 14.756 2 12 2C9.242 2 7 4.243 7 7V11C5.897 11 5 11.896 5 13V20C5 21.103 5.897 22 7 22H17C18.103 22 19 21.103 19 20V13C19 11.896 18.103 11 17 11ZM12 18C11.172 18 10.5 17.328 10.5 16.5C10.5 15.672 11.172 15 12 15C12.828 15 13.5 15.672 13.5 16.5C13.5 17.328 12.828 18 12 18ZM15 11H9V7C9 5.346 10.346 4 12 4C13.654 4 15 5.346 15 7V11Z"></path></svg>` icon: `<svg name="LockClosed" aria-hidden="false" width="%%width" height="%%height" viewBox="0 0 24 24"><path fill="%%color" d="M17 11V7C17 4.243 14.756 2 12 2C9.242 2 7 4.243 7 7V11C5.897 11 5 11.896 5 13V20C5 21.103 5.897 22 7 22H17C18.103 22 19 21.103 19 20V13C19 11.896 18.103 11 17 11ZM12 18C11.172 18 10.5 17.328 10.5 16.5C10.5 15.672 11.172 15 12 15C12.828 15 13.5 15.672 13.5 16.5C13.5 17.328 12.828 18 12 18ZM15 11H9V7C9 5.346 10.346 4 12 4C13.654 4 15 5.346 15 7V11Z"></path></svg>`
}, },
MENU_CARET: {
getClassName: props => BDFDB.DOMUtils.formatClassName(BDFDB.disCN.menucaretarrow, props.open && BDFDB.disCN.menucaretopen),
icon: `<svg name="MenuCaret" aria-hidden="false" width="%%width" height="%%height" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd" aria-hidden="true"><path fill="%%color" d="M16.59 8.59004L12 13.17L7.41 8.59004L6 10L12 16L18 10L16.59 8.59004Z"></path></g></svg>`
},
NOVA_AT: { NOVA_AT: {
icon: `<svg name="Nova_At" aria-hidden="false" width="%%width" height="%%height" viewBox="0 0 24 24"><path fill="%%color" d="M12 2C6.486 2 2 6.486 2 12C2 17.515 6.486 22 12 22C14.039 22 15.993 21.398 17.652 20.259L16.521 18.611C15.195 19.519 13.633 20 12 20C7.589 20 4 16.411 4 12C4 7.589 7.589 4 12 4C16.411 4 20 7.589 20 12V12.782C20 14.17 19.402 15 18.4 15L18.398 15.018C18.338 15.005 18.273 15 18.209 15H18C17.437 15 16.6 14.182 16.6 13.631V12C16.6 9.464 14.537 7.4 12 7.4C9.463 7.4 7.4 9.463 7.4 12C7.4 14.537 9.463 16.6 12 16.6C13.234 16.6 14.35 16.106 15.177 15.313C15.826 16.269 16.93 17 18 17L18.002 16.981C18.064 16.994 18.129 17 18.195 17H18.4C20.552 17 22 15.306 22 12.782V12C22 6.486 17.514 2 12 2ZM12 14.599C10.566 14.599 9.4 13.433 9.4 11.999C9.4 10.565 10.566 9.399 12 9.399C13.434 9.399 14.6 10.565 14.6 11.999C14.6 13.433 13.434 14.599 12 14.599Z"></path></svg>` icon: `<svg name="Nova_At" aria-hidden="false" width="%%width" height="%%height" viewBox="0 0 24 24"><path fill="%%color" d="M12 2C6.486 2 2 6.486 2 12C2 17.515 6.486 22 12 22C14.039 22 15.993 21.398 17.652 20.259L16.521 18.611C15.195 19.519 13.633 20 12 20C7.589 20 4 16.411 4 12C4 7.589 7.589 4 12 4C16.411 4 20 7.589 20 12V12.782C20 14.17 19.402 15 18.4 15L18.398 15.018C18.338 15.005 18.273 15 18.209 15H18C17.437 15 16.6 14.182 16.6 13.631V12C16.6 9.464 14.537 7.4 12 7.4C9.463 7.4 7.4 9.463 7.4 12C7.4 14.537 9.463 16.6 12 16.6C13.234 16.6 14.35 16.106 15.177 15.313C15.826 16.269 16.93 17 18 17L18.002 16.981C18.064 16.994 18.129 17 18.195 17H18.4C20.552 17 22 15.306 22 12.782V12C22 6.486 17.514 2 12 2ZM12 14.599C10.566 14.599 9.4 13.433 9.4 11.999C9.4 10.565 10.566 9.399 12 9.399C13.434 9.399 14.6 10.565 14.6 11.999C14.6 13.433 13.434 14.599 12 14.599Z"></path></svg>`
}, },

File diff suppressed because one or more lines are too long

View File

@ -270,7 +270,6 @@ var ChatAliases = (_ => {
label: "Add to ChatAliases", label: "Add to ChatAliases",
id: BDFDB.ContextMenuUtils.createItemId(this.name, "add-alias"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "add-alias"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openAddModal(text.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")); this.openAddModal(text.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t"));
} }
}) })

View File

@ -249,7 +249,6 @@ var ChatFilter = (_ => {
label: "Add to ChatFilter", label: "Add to ChatFilter",
id: BDFDB.ContextMenuUtils.createItemId(this.name, "add-filter"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "add-filter"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openAddModal(text.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")); this.openAddModal(text.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t"));
} }
}) })

View File

@ -116,7 +116,6 @@ var CopyRawMessage = (_ => {
}); });
}), }),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.LibraryRequires.electron.clipboard.write({text:messageString}); BDFDB.LibraryRequires.electron.clipboard.write({text:messageString});
} }
}), }),
@ -124,7 +123,6 @@ var CopyRawMessage = (_ => {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw Embed)", label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw Embed)",
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-embed"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-embed"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.LibraryRequires.electron.clipboard.write({text:embedString}); BDFDB.LibraryRequires.electron.clipboard.write({text:embedString});
} }
}) })

View File

@ -166,7 +166,6 @@ var DisplayLargeMessages = (_ => {
label: this.labels.context_uninjectattchment_text, label: this.labels.context_uninjectattchment_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "uninject-attachment"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "uninject-attachment"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
delete encodedMessages[e.instance.props.message.id]; delete encodedMessages[e.instance.props.message.id];
BDFDB.ModuleUtils.forceAllUpdates(this, ["Messages", "Attachment"]); BDFDB.ModuleUtils.forceAllUpdates(this, ["Messages", "Attachment"]);
} }

View File

@ -160,7 +160,6 @@ var EditChannels = (_ => {
label: this.labels.submenu_channelsettings_text, label: this.labels.submenu_channelsettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openChannelSettingsModal(e.instance.props.channel); this.openChannelSettingsModal(e.instance.props.channel);
} }
}), }),
@ -169,7 +168,6 @@ var EditChannels = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
disabled: !changedChannels[e.instance.props.channel.id], disabled: !changedChannels[e.instance.props.channel.id],
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id); BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.forceUpdateAll(); this.forceUpdateAll();
} }

View File

@ -170,7 +170,6 @@ var EditServers = (_ => {
label: this.labels.submenu_serversettings_text, label: this.labels.submenu_serversettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openGuildSettingsModal(e.instance.props.guild.id); this.openGuildSettingsModal(e.instance.props.guild.id);
} }
}), }),
@ -179,7 +178,6 @@ var EditServers = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
disabled: !changedGuilds[e.instance.props.guild.id], disabled: !changedGuilds[e.instance.props.guild.id],
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DataUtils.remove(this, "servers", e.instance.props.guild.id); BDFDB.DataUtils.remove(this, "servers", e.instance.props.guild.id);
this.forceUpdateAll(); this.forceUpdateAll();
} }

View File

@ -268,7 +268,6 @@ var EditUsers = (_ => {
label: this.labels.submenu_usersettings_text, label: this.labels.submenu_usersettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openUserSettingsModal(e.instance.props.user); this.openUserSettingsModal(e.instance.props.user);
} }
}), }),
@ -277,7 +276,6 @@ var EditUsers = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
disabled: !changedUsers[e.instance.props.user.id], disabled: !changedUsers[e.instance.props.user.id],
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DataUtils.remove(this, "users", e.instance.props.user.id); BDFDB.DataUtils.remove(this, "users", e.instance.props.user.id);
this.forceUpdateAll(); this.forceUpdateAll();
} }

View File

@ -138,9 +138,10 @@ var GoogleSearchReplace = (_ => {
children.splice(index, 1, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children.splice(index, 1, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_googlesearchreplace_text.replace("...", this.defaults.engines[engineKeys[0]].name), label: this.labels.context_googlesearchreplace_text.replace("...", this.defaults.engines[engineKeys[0]].name),
id: children[index].props.id, id: children[index].props.id,
persisting: true,
action: event => { action: event => {
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance); if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url.replace(textUrlReplaceString, encodeURIComponent(text)), settings.useChromium, event.shiftKey); BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url.replace(textUrlReplaceString, encodeURIComponent(text)), !settings.useChromium, event.shiftKey);
} }
})); }));
} }
@ -150,6 +151,7 @@ var GoogleSearchReplace = (_ => {
label: this.defaults.engines[key].name, label: this.defaults.engines[key].name,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "search", key), id: BDFDB.ContextMenuUtils.createItemId(this.name, "search", key),
color: key == "_all" ? BDFDB.LibraryComponents.MenuItems.Colors.DANGER : BDFDB.LibraryComponents.MenuItems.Colors.DEFAULT, color: key == "_all" ? BDFDB.LibraryComponents.MenuItems.Colors.DANGER : BDFDB.LibraryComponents.MenuItems.Colors.DEFAULT,
persisting: true,
action: event => { action: event => {
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance); if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance);
if (key == "_all") { if (key == "_all") {

View File

@ -183,7 +183,6 @@ var GoogleTranslateOption = (_ => {
}), }),
disabled: !translated && isTranslating, disabled: !translated && isTranslating,
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.translateMessage(e.instance.props.message, e.instance.props.channel); this.translateMessage(e.instance.props.message, e.instance.props.channel);
} }
})); }));
@ -217,7 +216,6 @@ var GoogleTranslateOption = (_ => {
}; };
if (foundTranslation && foundInput && foundOutput) { if (foundTranslation && foundInput && foundOutput) {
if (document.querySelector(".googletranslate-tooltip")) { if (document.querySelector(".googletranslate-tooltip")) {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DiscordUtils.openLink(this.getGoogleTranslatePageURL(foundInput.id, foundOutput.id, text), settings.useChromium); BDFDB.DiscordUtils.openLink(this.getGoogleTranslatePageURL(foundInput.id, foundOutput.id, text), settings.useChromium);
} }
else createTooltip(); else createTooltip();

View File

@ -142,7 +142,6 @@ var PersonalPins = (_ => {
}); });
}), }),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.addMessageToNotes(e.instance.props.message, e.instance.props.channel); this.addMessageToNotes(e.instance.props.message, e.instance.props.channel);
} }
})); }));
@ -150,7 +149,6 @@ var PersonalPins = (_ => {
label: this.labels.context_updateoption_text, label: this.labels.context_updateoption_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "update-note"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "update-note"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.updateNoteData(note, e.instance.props.message); this.updateNoteData(note, e.instance.props.message);
} }
})); }));

View File

@ -238,7 +238,6 @@ var PinDMs = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "unpin-channellist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "unpin-channellist"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER, color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
this.removeFromCategory(id, currentCategory, "dmCategories"); this.removeFromCategory(id, currentCategory, "dmCategories");
} }
}) : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { }) : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
@ -246,7 +245,6 @@ var PinDMs = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "new-channellist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "new-channellist"),
color: BDFDB.LibraryComponents.MenuItems.Colors.BRAND, color: BDFDB.LibraryComponents.MenuItems.Colors.BRAND,
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
this.openCategorySettingsModal({ this.openCategorySettingsModal({
id: this.generateID("dmCategories").toString(), id: this.generateID("dmCategories").toString(),
name: `${this.labels.header_pinneddms_text} #${categories.length + 1}`, name: `${this.labels.header_pinneddms_text} #${categories.length + 1}`,
@ -263,7 +261,6 @@ var PinDMs = (_ => {
label: category.name || this.labels.header_pinneddms_text, label: category.name || this.labels.header_pinneddms_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "pin-channellist", category.id), id: BDFDB.ContextMenuUtils.createItemId(this.name, "pin-channellist", category.id),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
if (currentCategory) this.removeFromCategory(id, currentCategory, "dmCategories"); if (currentCategory) this.removeFromCategory(id, currentCategory, "dmCategories");
this.addToCategory(id, category, "dmCategories"); this.addToCategory(id, category, "dmCategories");
} }
@ -276,7 +273,6 @@ var PinDMs = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"),
danger: pinnedInGuild, danger: pinnedInGuild,
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
if (!pinnedInGuild) this.addPin(id, "pinnedRecents"); if (!pinnedInGuild) this.addPin(id, "pinnedRecents");
else this.removePin(id, "pinnedRecents"); else this.removePin(id, "pinnedRecents");
} }

View File

@ -576,7 +576,6 @@ var PluginRepo = (_ => {
label: "Plugin Repo", label: "Plugin Repo",
id: BDFDB.ContextMenuUtils.createItemId(this.name, "repo"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "repo"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.LibraryModules.UserSettingsUtils.open("pluginrepo"); BDFDB.LibraryModules.UserSettingsUtils.open("pluginrepo");
} }
})); }));

View File

@ -206,7 +206,6 @@ var ReadAllNotificationsButton = (_ => {
id: "mark-dm-read", id: "mark-dm-read",
disabled: !BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds().includes(channelId), disabled: !BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds().includes(channelId),
action: event => { action: event => {
BDFDB.ContextMenuUtils.close(event.target);
BDFDB.DMUtils.markAsRead(channelId); BDFDB.DMUtils.markAsRead(channelId);
} }
}) })
@ -240,7 +239,6 @@ var ReadAllNotificationsButton = (_ => {
label: this.labels.context_unreadguilds_text, label: this.labels.context_unreadguilds_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-unread-read"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-unread-read"),
action: event2 => { action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
this.markGuildsAsRead(BDFDB.GuildUtils.getUnread()); this.markGuildsAsRead(BDFDB.GuildUtils.getUnread());
} }
}), }),
@ -248,7 +246,6 @@ var ReadAllNotificationsButton = (_ => {
label: this.labels.context_pingedguilds_text, label: this.labels.context_pingedguilds_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-pinged-read"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-pinged-read"),
action: event2 => { action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
this.markGuildsAsRead(BDFDB.GuildUtils.getPinged()); this.markGuildsAsRead(BDFDB.GuildUtils.getPinged());
} }
}), }),
@ -256,7 +253,6 @@ var ReadAllNotificationsButton = (_ => {
label: this.labels.context_mutedguilds_text, label: this.labels.context_mutedguilds_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-muted-read"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-muted-read"),
action: event2 => { action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
this.markGuildsAsRead(BDFDB.GuildUtils.getMuted()); this.markGuildsAsRead(BDFDB.GuildUtils.getMuted());
} }
}), }),
@ -264,7 +260,6 @@ var ReadAllNotificationsButton = (_ => {
label: this.labels.context_guilds_text, label: this.labels.context_guilds_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-all-read"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-all-read"),
action: event2 => { action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
this.addPinnedRecent(instance.props.channel.id); this.addPinnedRecent(instance.props.channel.id);
this.markGuildsAsRead(BDFDB.GuildUtils.getAll()); this.markGuildsAsRead(BDFDB.GuildUtils.getAll());
} }
@ -273,7 +268,6 @@ var ReadAllNotificationsButton = (_ => {
label: this.labels.context_dms_text, label: this.labels.context_dms_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-dms-read"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "mark-dms-read"),
action: event2 => { action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
BDFDB.DMUtils.markAsRead(BDFDB.DMUtils.getAll()); BDFDB.DMUtils.markAsRead(BDFDB.DMUtils.getAll());
} }
}) })

View File

@ -76,7 +76,6 @@ var RevealAllSpoilersOption = (_ => {
}); });
}), }),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.revealAllSpoilers(messageDiv); this.revealAllSpoilers(messageDiv);
} }
}) })

View File

@ -171,6 +171,7 @@ var ReverseImageSearch = (_ => {
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_reverseimagesearch_text.replace("...", this.defaults.engines[engineKeys[0]].name), label: this.labels.context_reverseimagesearch_text.replace("...", this.defaults.engines[engineKeys[0]].name),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "single-search"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "single-search"),
persisting: true,
action: event => { action: event => {
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance); if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url.replace(imgUrlReplaceString, encodeURIComponent(url)), settings.useChromium, event.shiftKey); BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url.replace(imgUrlReplaceString, encodeURIComponent(url)), settings.useChromium, event.shiftKey);
@ -183,6 +184,7 @@ var ReverseImageSearch = (_ => {
label: this.defaults.engines[key].name, label: this.defaults.engines[key].name,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "search", key), id: BDFDB.ContextMenuUtils.createItemId(this.name, "search", key),
color: key == "_all" ? BDFDB.LibraryComponents.MenuItems.Colors.DANGER : BDFDB.LibraryComponents.MenuItems.Colors.DEFAULT, color: key == "_all" ? BDFDB.LibraryComponents.MenuItems.Colors.DANGER : BDFDB.LibraryComponents.MenuItems.Colors.DEFAULT,
persisting: true,
action: event => { action: event => {
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance); if (!event.shiftKey) BDFDB.ContextMenuUtils.close(e.instance);
if (key == "_all") { if (key == "_all") {

View File

@ -550,7 +550,6 @@ var ServerFolders = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-from-folder"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-from-folder"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER, color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.removeGuildFromFolder(folder.folderId, e.instance.props.guild.id); this.removeGuildFromFolder(folder.folderId, e.instance.props.guild.id);
} }
}) })
@ -560,7 +559,6 @@ var ServerFolders = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "create-folder"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "create-folder"),
disabled: !unfolderedGuilds.length, disabled: !unfolderedGuilds.length,
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openFolderCreationMenu(unfolderedGuilds, e.instance.props.guild.id); this.openFolderCreationMenu(unfolderedGuilds, e.instance.props.guild.id);
} }
}), }),
@ -572,7 +570,6 @@ var ServerFolders = (_ => {
label: folder.folderName || `${BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER} #${i + 1}`, label: folder.folderName || `${BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER} #${i + 1}`,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "add-to-folder", i + 1), id: BDFDB.ContextMenuUtils.createItemId(this.name, "add-to-folder", i + 1),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.addGuildToFolder(folder.folderId, e.instance.props.guild.id); this.addGuildToFolder(folder.folderId, e.instance.props.guild.id);
} }
})) }))
@ -621,7 +618,6 @@ var ServerFolders = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-folder"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-folder"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER, color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
action: event => { action: event => {
BDFDB.ContextMenuUtils.close(event.target);
BDFDB.ModalUtils.confirm(this, `Are you sure you want to remove the folder${folder.folderName ? ` '${folder.folderName}'` : ""}?`, _ => { BDFDB.ModalUtils.confirm(this, `Are you sure you want to remove the folder${folder.folderName ? ` '${folder.folderName}'` : ""}?`, _ => {
this.removeFolder(e.instance.props.folderId); this.removeFolder(e.instance.props.folderId);
}); });

View File

@ -130,7 +130,6 @@ var ServerHider = (_ => {
label: this.labels.submenu_openhidemenu_text, label: this.labels.submenu_openhidemenu_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "openmenu"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "openmenu"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
this.showHideModal(); this.showHideModal();
} }
}), }),
@ -138,7 +137,6 @@ var ServerHider = (_ => {
label: instance.props.guild ? this.labels.submenu_hideserver_text : this.labels.submenu_hidefolder_text, label: instance.props.guild ? this.labels.submenu_hideserver_text : this.labels.submenu_hidefolder_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "hide"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "hide"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
if (instance.props.guild) this.toggleItem(BDFDB.DataUtils.load(this, "hidden", "servers") || [], instance.props.guild.id, "servers"); if (instance.props.guild) this.toggleItem(BDFDB.DataUtils.load(this, "hidden", "servers") || [], instance.props.guild.id, "servers");
else this.toggleItem(BDFDB.DataUtils.load(this, "hidden", "folders") || [], instance.props.folderId, "folders"); else this.toggleItem(BDFDB.DataUtils.load(this, "hidden", "folders") || [], instance.props.folderId, "folders");
} }

View File

@ -287,7 +287,6 @@ var ShowHiddenChannels = (_ => {
label: BDFDB.LanguageUtils.LanguageStrings.CHANNEL + " " + BDFDB.LanguageUtils.LanguageStrings.ACCESSIBILITY, label: BDFDB.LanguageUtils.LanguageStrings.CHANNEL + " " + BDFDB.LanguageUtils.LanguageStrings.ACCESSIBILITY,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "permissions"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "permissions"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.showAccessModal(e.instance.props.channel, !isHidden); this.showAccessModal(e.instance.props.channel, !isHidden);
} }
}) })

View File

@ -211,7 +211,6 @@ var SpellCheck = (_ => {
}); });
}, },
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.addToOwnDictionary(word); this.addToOwnDictionary(word);
} }
}), }),
@ -224,7 +223,6 @@ var SpellCheck = (_ => {
label: suggestion, label: suggestion,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "suggestion", suggestion), id: BDFDB.ContextMenuUtils.createItemId(this.name, "suggestion", suggestion),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.replaceWord(e.instance.props.editor, word, suggestion); this.replaceWord(e.instance.props.editor, word, suggestion);
} }
})) }))

View File

@ -862,7 +862,6 @@ var ThemeRepo = (_ => {
label: "Theme Repo", label: "Theme Repo",
id: BDFDB.ContextMenuUtils.createItemId(this.name, "repo"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "repo"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.LibraryModules.UserSettingsUtils.open("themerepo"); BDFDB.LibraryModules.UserSettingsUtils.open("themerepo");
} }
})); }));

View File

@ -95,7 +95,6 @@ var UserNotes = (_ => {
label: BDFDB.LanguageUtils.LanguageStrings.USERS + " " + BDFDB.LanguageUtils.LanguageStrings.NOTE, label: BDFDB.LanguageUtils.LanguageStrings.USERS + " " + BDFDB.LanguageUtils.LanguageStrings.NOTE,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "user-note"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "user-note"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openNotesModal(e.instance.props.user); this.openNotesModal(e.instance.props.user);
} }
}) })