From f2fd1b3068a43c057243159f9228c8ef3aaa4428 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 28 Jun 2019 14:52:24 +0200 Subject: Fix settings window dependence --- src/containers/settings/SettingsWindow.js | 35 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'src/containers/settings/SettingsWindow.js') diff --git a/src/containers/settings/SettingsWindow.js b/src/containers/settings/SettingsWindow.js index 663b9e2e4..440d32a46 100644 --- a/src/containers/settings/SettingsWindow.js +++ b/src/containers/settings/SettingsWindow.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import { observer, inject } from 'mobx-react'; @@ -10,10 +11,23 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; import { workspaceStore } from '../../features/workspaces'; export default @inject('stores', 'actions') @observer class SettingsContainer extends Component { + portalRoot = document.querySelector('#portalContainer'); + + el = document.createElement('div'); + + componentDidMount() { + this.portalRoot.appendChild(this.el); + } + + componentWillUnmount() { + this.portalRoot.removeChild(this.el); + } + render() { const { children, stores } = this.props; const { closeSettings } = this.props.actions.ui; + const navigation = ( ); - return ( - - - {children} - - + return ReactDOM.createPortal( + ( + + + {children} + + + ), + this.el, ); } } -- cgit v1.2.3-70-g09d2