Skip to content

Commit

Permalink
Edit Post: Remove SlotFillProvider as rendered by block editor (#15988)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored and jorgefilipecosta committed Jun 17, 2019
1 parent 06eb744 commit 763fb65
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 37 deletions.
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

- `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

0 comments on commit 763fb65

Please sign in to comment.