Skip to content

Commit

Permalink
Block Editor: Pass spread props from URLPopover to Popover
Browse files Browse the repository at this point in the history
Avoids need to explicitly support onClickOutside as deprecated pass-through prop, instead leveraging pass-through nature of spread props.
  • Loading branch information
aduth committed Apr 5, 2019
1 parent 302f25d commit fc1fec7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
3 changes: 2 additions & 1 deletion packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
- Added the `dropZoneUIOnly` property to the `MediaPlaceholder` component. The property makes the `MediaPlaceholder` only render a dropzone without any other additional UI.
- Added a cancel link to the list of buttons in the `MediaPlaceholder` component which appears if an `onCancel` handler exists
- Added the usage of `mediaPreview` for the `Placeholder` component to the `MediaPlaceholder` component
- Added a an `onDoubleClick` event handler to the `MediaPlaceholder` component
- Added an `onDoubleClick` event handler to the `MediaPlaceholder` component
- The `URLPopover` component now passes through all unhandled props to the underlying Popover component.

### Breaking Changes

Expand Down
10 changes: 1 addition & 9 deletions packages/block-editor/src/components/url-popover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class MyURLPopover extends Component {

## Props

The component accepts the following props.
The component accepts the following props. Any other props are passed through to the underlying `Popover` component ([refer to props documentation](/packages/components/src/popover/README.md)).

### position

Expand All @@ -104,14 +104,6 @@ an element.
- Required: No
- Default: "firstElement"

### onClose

Callback that triggers when the user indicates the popover should close (e.g. they've used the escape key or clicked
outside of the popover.)

- Type: `Function`
- Required: No

### renderSettings

Callback used to return the React Elements that will be rendered inside the settings drawer. When this function
Expand Down
6 changes: 2 additions & 4 deletions packages/block-editor/src/components/url-popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ class URLPopover extends Component {
const {
children,
renderSettings,
onClose,
onClickOutside,
position = 'bottom center',
focusOnMount = 'firstElement',
...popoverProps
} = this.props;

const {
Expand All @@ -46,8 +45,7 @@ class URLPopover extends Component {
className="editor-url-popover block-editor-url-popover"
focusOnMount={ focusOnMount }
position={ position }
onClose={ onClose }
onClickOutside={ onClickOutside }
{ ...popoverProps }
>
<div className="editor-url-popover__row block-editor-url-popover__row">
{ children }
Expand Down

0 comments on commit fc1fec7

Please sign in to comment.