-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter DropZone and MediaPlaceholder components (#11184)
* Export Media Placeholder withFilters * Export Block Drop Zone withFilters * Update test snapshots * Appropriately name DropZone filter * Add super-simple README files * Move withFilters call into the compose function * Update README.md * Update README.md
- Loading branch information
1 parent
cc53d7c
commit fe51bd0
Showing
5 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
BlockDropZone | ||
=========== | ||
|
||
`BlockDropZone` is a React component that renders a container which allows a user to drag media into the editor and immediately place it. | ||
|
||
## Setup | ||
|
||
It includes a `wp.hooks` filter `editor.BlockDropZone` that enables developers to replace or extend it. | ||
|
||
_Example:_ | ||
|
||
Replace implementation of the drop zone: | ||
|
||
```js | ||
function replaceBlockDropZone() { | ||
return function() { | ||
return wp.element.createElement( | ||
'div', | ||
{}, | ||
'The replacement contents or components.' | ||
); | ||
} | ||
} | ||
|
||
wp.hooks.addFilter( | ||
'editor.BlockDropZone', | ||
'my-plugin/replace-block-drop-zone', | ||
replaceBlockDropZone | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/editor/src/components/media-placeholder/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
MediaPlaceholder | ||
=========== | ||
|
||
`MediaPlaceholder` is a React component used to render either the media associated with a block, or an editing interface to replace the media for a block. | ||
|
||
## Setup | ||
|
||
It includes a `wp.hooks` filter `editor.MediaPlaceholder` that enables developers to replace or extend it. | ||
|
||
_Example:_ | ||
|
||
Replace implementation of the placeholder: | ||
|
||
```js | ||
function replaceMediaPlaceholder() { | ||
return function() { | ||
return wp.element.createElement( | ||
'div', | ||
{}, | ||
'The replacement contents or components.' | ||
); | ||
} | ||
} | ||
|
||
wp.hooks.addFilter( | ||
'editor.MediaPlaceholder', | ||
'my-plugin/replace-media-placeholder', | ||
replaceMediaPlaceholder | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters