diff --git a/app/components/DropToImport/DropToImport.js b/app/components/DropToImport/DropToImport.js
index 34bb84cc18..b78a6fe80d 100644
--- a/app/components/DropToImport/DropToImport.js
+++ b/app/components/DropToImport/DropToImport.js
@@ -97,7 +97,9 @@ class DropToImport extends Component {
'documentId',
'collectionId',
'documents',
- 'disabled'
+ 'disabled',
+ 'dropzoneRef',
+ 'menuOpen'
);
if (this.props.disabled) return this.props.children;
diff --git a/app/components/DropdownMenu/DropdownMenu.js b/app/components/DropdownMenu/DropdownMenu.js
index e53048333f..6e5f86972a 100644
--- a/app/components/DropdownMenu/DropdownMenu.js
+++ b/app/components/DropdownMenu/DropdownMenu.js
@@ -4,7 +4,7 @@ import invariant from 'invariant';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import styled from 'styled-components';
-import Portal from 'react-portal';
+import { PortalWithState } from 'react-portal';
import Flex from 'shared/components/Flex';
import { color } from 'shared/styles/constants';
import { fadeAndScaleIn } from 'shared/styles/animations';
@@ -19,58 +19,54 @@ type Props = {
@observer class DropdownMenu extends Component {
props: Props;
- actionRef: Object;
- @observable open: boolean = false;
@observable top: number;
@observable left: number;
@observable right: number;
- handleClick = (ev: SyntheticEvent) => {
- ev.preventDefault();
- ev.stopPropagation();
- const currentTarget = ev.currentTarget;
- invariant(document.body, 'why you not here');
+ handleOpen = (openPortal: SyntheticEvent => void) => {
+ return (ev: SyntheticMouseEvent) => {
+ ev.preventDefault();
+ ev.stopPropagation();
+ const currentTarget = ev.currentTarget;
+ invariant(document.body, 'why you not here');
- if (currentTarget instanceof HTMLDivElement) {
- const bodyRect = document.body.getBoundingClientRect();
- const targetRect = currentTarget.getBoundingClientRect();
- this.open = true;
- this.top = targetRect.bottom - bodyRect.top;
- this.right = bodyRect.width - targetRect.left - targetRect.width;
- if (this.props.onOpen) this.props.onOpen();
- }
- };
-
- handleClose = (ev: SyntheticEvent) => {
- this.open = false;
- if (this.props.onClose) this.props.onClose();
+ if (currentTarget instanceof HTMLDivElement) {
+ const bodyRect = document.body.getBoundingClientRect();
+ const targetRect = currentTarget.getBoundingClientRect();
+ this.top = targetRect.bottom - bodyRect.top;
+ this.right = bodyRect.width - targetRect.left - targetRect.width;
+ openPortal(ev);
+ }
+ };
};
render() {
return (
-
-
-
-
+ {({ closePortal, openPortal, portal }) => [
+
,
+ portal(
+
+ ),
+ ]}
+
);
}
diff --git a/app/components/Editor/components/BlockInsert.js b/app/components/Editor/components/BlockInsert.js
index 475b975773..b021a47aae 100644
--- a/app/components/Editor/components/BlockInsert.js
+++ b/app/components/Editor/components/BlockInsert.js
@@ -1,6 +1,6 @@
// @flow
import React, { Component } from 'react';
-import Portal from 'react-portal';
+import { Portal } from 'react-portal';
import { findDOMNode, Node } from 'slate';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
@@ -112,7 +112,7 @@ export default class BlockInsert extends Component {
const style = { top: `${this.top}px`, left: `${this.left}px` };
return (
-
+
diff --git a/app/components/Editor/components/Code.js b/app/components/Editor/components/Code.js
index e37455be2c..4268db32c1 100644
--- a/app/components/Editor/components/Code.js
+++ b/app/components/Editor/components/Code.js
@@ -4,6 +4,7 @@ import styled from 'styled-components';
import CopyButton from './CopyButton';
import { color } from 'shared/styles/constants';
import type { Props } from '../types';
+import 'shared/styles/prism.css';
export default function Code({ children, node, readOnly, attributes }: Props) {
const language = node.data.get('language') || 'javascript';
diff --git a/app/components/Editor/components/Toolbar/Toolbar.js b/app/components/Editor/components/Toolbar/Toolbar.js
index d34966d90e..8d4eec4e3d 100644
--- a/app/components/Editor/components/Toolbar/Toolbar.js
+++ b/app/components/Editor/components/Toolbar/Toolbar.js
@@ -1,6 +1,6 @@
// @flow
import React, { Component } from 'react';
-import Portal from 'react-portal';
+import { Portal } from 'react-portal';
import styled from 'styled-components';
import _ from 'lodash';
import type { State } from '../../types';
@@ -118,7 +118,7 @@ export default class Toolbar extends Component {
};
return (
-
+