Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert React Portals for most uses #3083

Merged
merged 1 commit into from
Oct 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion blocks/block-controls/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/**
* External dependencies
*/
import { Fill } from 'react-slot-fill';

/**
* WordPress dependencies
*/
import { Fill, Toolbar } from '@wordpress/components';
import { Toolbar } from '@wordpress/components';

export default function BlockControls( { controls, children } ) {
return (
Expand Down
2 changes: 1 addition & 1 deletion blocks/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {
noop,
} from 'lodash';
import { nodeListToReact } from 'dom-react';
import { Fill } from 'react-slot-fill';
import 'element-closest';

/**
* WordPress dependencies
*/
import { createElement, Component, renderToString } from '@wordpress/element';
import { keycodes } from '@wordpress/utils';
import { Fill } from '@wordpress/components';

/**
* Internal dependencies
Expand Down
4 changes: 2 additions & 2 deletions blocks/inspector-controls/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
* External dependencies
*/
import { Fill } from '@wordpress/components';
import { Fill } from 'react-slot-fill';

/**
* Internal dependencies
Expand Down
3 changes: 2 additions & 1 deletion editor/block-toolbar/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/**
* External dependencies
*/
import { Slot } from 'react-slot-fill';
import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup';
import classnames from 'classnames';

/**
* WordPress Dependencies
*/
import { IconButton, Toolbar, NavigableMenu, Slot } from '@wordpress/components';
import { IconButton, Toolbar, NavigableMenu } from '@wordpress/components';
import { Component, Children, findDOMNode } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { focus, keycodes } from '@wordpress/utils';
Expand Down
13 changes: 11 additions & 2 deletions editor/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { bindActionCreators } from 'redux';
import { Provider as ReduxProvider } from 'react-redux';
import { Provider as SlotFillProvider } from 'react-slot-fill';
import { flow, pick, noop } from 'lodash';

/**
Expand All @@ -13,7 +14,7 @@ import { EditableProvider } from '@wordpress/blocks';
import {
APIProvider,
DropZoneProvider,
SlotFillProvider,
SlotFillProvider as WPSlotFillProvider,
} from '@wordpress/components';

/**
Expand Down Expand Up @@ -79,6 +80,14 @@ class EditorProvider extends Component {
{ store: this.store },
],

// Slot / Fill provider:
//
// - context.slots
// - context.fills
[
SlotFillProvider,
],

// Editable provider:
//
// - context.onUndo
Expand All @@ -95,7 +104,7 @@ class EditorProvider extends Component {
// - context.registerSlot
// - context.unregisterSlot
[
SlotFillProvider,
WPSlotFillProvider,
],

// APIProvider
Expand Down
3 changes: 2 additions & 1 deletion editor/sidebar/block-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
* External dependencies
*/
import { connect } from 'react-redux';
import { Slot } from 'react-slot-fill';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Panel, PanelBody, Slot } from '@wordpress/components';
import { Panel, PanelBody } from '@wordpress/components';

/**
* Internal Dependencies
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"react-dom": "15.6.1",
"react-redux": "5.0.6",
"react-resizable-box": "2.0.6",
"react-slot-fill": "1.0.1",
"react-transition-group": "1.2.0",
"redux": "3.7.2",
"redux-multi": "0.1.12",
Expand Down
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ const config = {
__dirname,
'node_modules',
],
alias: {
// There are currently resolution errors on RSF's "mitt" dependency
// when imported as native ES module
'react-slot-fill': 'react-slot-fill/lib/rsf.js',
},
},
module: {
rules: [
Expand Down