stuff
This commit is contained in:
parent
1e351fec66
commit
c003d5934b
|
@ -6540,6 +6540,9 @@ var BDFDB = {
|
||||||
LibraryComponents.NavItem = BDFDB.ModuleUtils.findByName("NavItem");
|
LibraryComponents.NavItem = BDFDB.ModuleUtils.findByName("NavItem");
|
||||||
|
|
||||||
LibraryComponents.Popout = reactInitialized ? class BDFDB_Popout extends LibraryModules.React.Component {
|
LibraryComponents.Popout = reactInitialized ? class BDFDB_Popout extends LibraryModules.React.Component {
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (typeof this.props.onClose == "function") this.props.onClose(this.props.containerInstance, this);
|
||||||
|
}
|
||||||
render() {
|
render() {
|
||||||
let pos = typeof this.props.position == "string" ? this.props.position.toLowerCase() : null;
|
let pos = typeof this.props.position == "string" ? this.props.position.toLowerCase() : null;
|
||||||
let position = pos && DiscordClasses["popout" + pos] ? BDFDB.disCN["popout" + pos] : BDFDB.disCN.popouttop;
|
let position = pos && DiscordClasses["popout" + pos] ? BDFDB.disCN["popout" + pos] : BDFDB.disCN.popouttop;
|
||||||
|
@ -6564,7 +6567,10 @@ var BDFDB = {
|
||||||
|
|
||||||
LibraryComponents.PopoutContainer = reactInitialized ? class BDFDB_PopoutContainer extends LibraryModules.React.Component {
|
LibraryComponents.PopoutContainer = reactInitialized ? class BDFDB_PopoutContainer extends LibraryModules.React.Component {
|
||||||
handleRender(e) {
|
handleRender(e) {
|
||||||
|
let onClose = typeof this.props.onClose == "function" ? this.props.onClose.bind(this) : _ => {};
|
||||||
return BDFDB.ReactUtils.createElement(LibraryComponents.Popout, {
|
return BDFDB.ReactUtils.createElement(LibraryComponents.Popout, {
|
||||||
|
containerInstance: this,
|
||||||
|
onClose: this.props.onClose,
|
||||||
className: this.props.popoutClassName,
|
className: this.props.popoutClassName,
|
||||||
isChild: true,
|
isChild: true,
|
||||||
position: e.position,
|
position: e.position,
|
||||||
|
@ -6581,10 +6587,7 @@ var BDFDB = {
|
||||||
let basepopout = BDFDB.ReactUtils.findOwner(this, {name:"BasePopout"});
|
let basepopout = BDFDB.ReactUtils.findOwner(this, {name:"BasePopout"});
|
||||||
if (!basepopout || !basepopout.handleClick) return;
|
if (!basepopout || !basepopout.handleClick) return;
|
||||||
this.handleClick = basepopout.handleClick;
|
this.handleClick = basepopout.handleClick;
|
||||||
this.close = (...args) => {
|
this.close = basepopout.close;
|
||||||
basepopout.close(...args);
|
|
||||||
if (typeof this.props.onClose == "function") this.props.onClose(this);
|
|
||||||
}
|
|
||||||
this.domElementRef = basepopout.domElementRef;
|
this.domElementRef = basepopout.domElementRef;
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
|
@ -6610,7 +6613,7 @@ var BDFDB = {
|
||||||
else e.stopPropagation();
|
else e.stopPropagation();
|
||||||
},
|
},
|
||||||
children: BDFDB.ReactUtils.createElement(NativeSubComponents.PopoutContainer, Object.assign({}, this.props, {
|
children: BDFDB.ReactUtils.createElement(NativeSubComponents.PopoutContainer, Object.assign({}, this.props, {
|
||||||
renderPopout: this.props.native && typeof this.props.renderPopout == "function" ? this.props.renderPopout : this.handleRender.bind(this)
|
renderPopout: this.handleRender.bind(this)
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -83,15 +83,14 @@ class CopyRawMessage {
|
||||||
onMessageOptionPopout (e) {
|
onMessageOptionPopout (e) {
|
||||||
if (e.instance.props && e.instance.props.message) {
|
if (e.instance.props && e.instance.props.message) {
|
||||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["label", BDFDB.LanguageUtils.LanguageStrings.DELETE]]});
|
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["label", BDFDB.LanguageUtils.LanguageStrings.DELETE]]});
|
||||||
const copyItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||||
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
|
||||||
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-copyraw-popoutMenuItem`,
|
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-copyraw-popoutMenuItem`,
|
||||||
action: _ => {
|
action: _ => {
|
||||||
BDFDB.LibraryRequires.electron.clipboard.write({text:e.instance.props.message.content});
|
BDFDB.LibraryRequires.electron.clipboard.write({text:e.instance.props.message.content});
|
||||||
e.instance.props.onClose();
|
e.instance.props.onClose();
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
children.splice(index, 0, copyItem);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue