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

Edit Post: Remove SlotFillProvider as rendered by block editor #15988

Merged
merged 2 commits into from
Jun 17, 2019
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
6 changes: 6 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Master

### Breaking Changes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to ## Master I guess.


- `BlockEditorProvider` no longer renders a wrapping `SlotFillProvider` or `DropZoneProvider` (from `@wordpress/components`). For custom block editors, you should render your own as wrapping the `BlockEditorProvider`. A future release will include a new `BlockEditor` component for simple, standard usage. `BlockEditorProvider` will serve the simple purpose of establishing its own context for block editors.

## 2.2.0 (2019-06-12)

### Internal
Expand Down
9 changes: 1 addition & 8 deletions packages/block-editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { DropZoneProvider, SlotFillProvider } from '@wordpress/components';
import { withDispatch } from '@wordpress/data';
import { compose } from '@wordpress/compose';

Expand Down Expand Up @@ -120,13 +119,7 @@ class BlockEditorProvider extends Component {
render() {
const { children } = this.props;

return (
<SlotFillProvider>
<DropZoneProvider>
{ children }
</DropZoneProvider>
</SlotFillProvider>
);
return children;
}
}

Expand Down
36 changes: 22 additions & 14 deletions packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { size, map, without } from 'lodash';
import { withSelect } from '@wordpress/data';
import { EditorProvider, ErrorBoundary, PostLockedModal } from '@wordpress/editor';
import { StrictMode, Component } from '@wordpress/element';
import { KeyboardShortcuts } from '@wordpress/components';
import {
KeyboardShortcuts,
SlotFillProvider,
DropZoneProvider,
} from '@wordpress/components';

/**
* Internal dependencies
Expand Down Expand Up @@ -87,19 +91,23 @@ class Editor extends Component {

return (
<StrictMode>
<EditorProvider
settings={ editorSettings }
post={ post }
initialEdits={ initialEdits }
useSubRegistry={ false }
{ ...props }
>
<ErrorBoundary onError={ onError }>
<Layout />
<KeyboardShortcuts shortcuts={ preventEventDiscovery } />
</ErrorBoundary>
<PostLockedModal />
</EditorProvider>
<SlotFillProvider>
<DropZoneProvider>
<EditorProvider
settings={ editorSettings }
post={ post }
initialEdits={ initialEdits }
useSubRegistry={ false }
{ ...props }
>
<ErrorBoundary onError={ onError }>
<Layout />
<KeyboardShortcuts shortcuts={ preventEventDiscovery } />
</ErrorBoundary>
<PostLockedModal />
</EditorProvider>
</DropZoneProvider>
</SlotFillProvider>
</StrictMode>
);
}
Expand Down
38 changes: 23 additions & 15 deletions playground/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
WritingFlow,
ObserveTyping,
} from '@wordpress/block-editor';
import { Popover } from '@wordpress/components';
import {
Popover,
SlotFillProvider,
DropZoneProvider,
} from '@wordpress/components';
import { registerCoreBlocks } from '@wordpress/block-library';
import '@wordpress/format-library';

Expand All @@ -37,20 +41,24 @@ function App() {
<h1 className="playground__logo">Gutenberg Playground</h1>
</div>
<div className="playground__body">
<BlockEditorProvider
value={ blocks }
onInput={ updateBlocks }
onChange={ updateBlocks }
>
<div className="editor-styles-wrapper">
<WritingFlow>
<ObserveTyping>
<BlockList />
</ObserveTyping>
</WritingFlow>
</div>
<Popover.Slot />
</BlockEditorProvider>
<SlotFillProvider>
<DropZoneProvider>
<BlockEditorProvider
value={ blocks }
onInput={ updateBlocks }
onChange={ updateBlocks }
>
<div className="editor-styles-wrapper">
<WritingFlow>
<ObserveTyping>
<BlockList />
</ObserveTyping>
</WritingFlow>
</div>
<Popover.Slot />
</BlockEditorProvider>
</DropZoneProvider>
</SlotFillProvider>
</div>
</Fragment>
);
Expand Down