diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 709577d3c4..37e50bb326 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -2,7 +2,7 @@ * @name BDFDB * @author DevilBro * @authorId 278543574059057154 - * @version 1.5.3 + * @version 1.5.2 * @description Required Library for DevilBro's Plugins * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -22,7 +22,7 @@ module.exports = (_ => { "info": { "name": "BDFDB", "author": "DevilBro", - "version": "1.5.3", + "version": "1.5.2", "description": "Required Library for DevilBro's Plugins" }, "rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js` @@ -2225,7 +2225,7 @@ module.exports = (_ => { } } if (LibraryModules.KeyCodeUtils) LibraryModules.KeyCodeUtils.getString = function (keyArray) { - return LibraryModules.KeyCodeUtils.toString([keyArray].flat(10).filter(n => n).map(keyCode => [BDFDB.DiscordConstants.KeyboardDeviceTypes.KEYBOARD_KEY, keyCode, BDFDB.DiscordConstants.KeyboardEnvs[LibraryModules.KeyCodeUtils.getEnv()]]), true); + return LibraryModules.KeyCodeUtils.toString([keyArray].flat(10).filter(n => n).map(keycode => [BDFDB.DiscordConstants.KeyboardDeviceTypes.KEYBOARD_KEY, keycode, BDFDB.DiscordConstants.KeyboardEnvs.BROWSER]), true); }; BDFDB.LibraryModules = Object.assign({}, LibraryModules); @@ -6097,21 +6097,15 @@ module.exports = (_ => { InternalComponents.LibraryComponents.KeybindRecorder = reactInitialized && class BDFDB_KeybindRecorder extends LibraryModules.React.Component { handleChange(arrays) { - this.props.defaultValue = []; - if (this.recorder) this.recorder.setState({codes: []}); - if (typeof this.props.onChange == "function") this.props.onChange(, this); + if (typeof this.props.onChange == "function") this.props.onChange(arrays.map(platformkey => LibraryModules.KeyEvents.codes[LibraryModules.KeyCodeUtils.codeToKey(platformkey)] || platformkey[1]), this); } handleReset() { this.props.defaultValue = []; - if (this.recorder) this.recorder.setState({codes: []}); + let recorder = BDFDB.ReactUtils.findOwner(this, {name: "KeybindRecorder"}); + if (recorder) recorder.setState({codes: []}); if (typeof this.props.onChange == "function") this.props.onChange([], this); if (typeof this.props.onReset == "function") this.props.onReset(this); } - componentDidMount() { - let basePopout = BDFDB.ReactUtils.findOwner(this, {name: "KeybindRecorder"}); - if (!recorder) return; - this.recorder = recorder; - } render() { return BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.Flex, { className: BDFDB.disCN.hotkeywrapper, @@ -6119,7 +6113,7 @@ module.exports = (_ => { align: InternalComponents.LibraryComponents.Flex.Align.CENTER, children: [ BDFDB.ReactUtils.createElement(InternalComponents.NativeSubComponents.KeybindRecorder, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, { - defaultValue: [this.props.defaultValue].flat(10).filter(n => n).map(keyCode => [BDFDB.DiscordConstants.KeyboardDeviceTypes.KEYBOARD_KEY, keyCode, BDFDB.DiscordConstants.KeyboardEnvs[LibraryModules.KeyCodeUtils.getEnv()]]), + defaultValue: [this.props.defaultValue].flat(10).filter(n => n).map(keycode => [BDFDB.DiscordConstants.KeyboardDeviceTypes.KEYBOARD_KEY, keycode, BDFDB.DiscordConstants.KeyboardEnvs.BROWSER]), onChange: this.handleChange.bind(this) }), "reset", "onReset")), this.props.reset || this.props.onReset ? BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.TooltipContainer, {