This commit is contained in:
Mirco Wittrien 2019-11-07 10:52:58 +01:00
parent 1e351fec66
commit c003d5934b
3 changed files with 11 additions and 9 deletions

View File

@ -6540,6 +6540,9 @@ var BDFDB = {
LibraryComponents.NavItem = BDFDB.ModuleUtils.findByName("NavItem");
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() {
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;
@ -6564,7 +6567,10 @@ var BDFDB = {
LibraryComponents.PopoutContainer = reactInitialized ? class BDFDB_PopoutContainer extends LibraryModules.React.Component {
handleRender(e) {
let onClose = typeof this.props.onClose == "function" ? this.props.onClose.bind(this) : _ => {};
return BDFDB.ReactUtils.createElement(LibraryComponents.Popout, {
containerInstance: this,
onClose: this.props.onClose,
className: this.props.popoutClassName,
isChild: true,
position: e.position,
@ -6581,10 +6587,7 @@ var BDFDB = {
let basepopout = BDFDB.ReactUtils.findOwner(this, {name:"BasePopout"});
if (!basepopout || !basepopout.handleClick) return;
this.handleClick = basepopout.handleClick;
this.close = (...args) => {
basepopout.close(...args);
if (typeof this.props.onClose == "function") this.props.onClose(this);
}
this.close = basepopout.close;
this.domElementRef = basepopout.domElementRef;
}
render() {
@ -6610,7 +6613,7 @@ var BDFDB = {
else e.stopPropagation();
},
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

View File

@ -83,15 +83,14 @@ class CopyRawMessage {
onMessageOptionPopout (e) {
if (e.instance.props && e.instance.props.message) {
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)",
className: `${BDFDB.disCN.optionpopoutitem} BDFDB-popoutMenuItem ${this.name}-popoutMenuItem ${this.name}-copyraw-popoutMenuItem`,
action: _ => {
BDFDB.LibraryRequires.electron.clipboard.write({text:e.instance.props.message.content});
e.instance.props.onClose();
}
});
children.splice(index, 0, copyItem);
}));
}
}
}