-
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.
Framework: Adding a legacy blocks package to avoid Breaking Changes
- Loading branch information
1 parent
94a905c
commit c21d30e
Showing
4 changed files
with
59 additions
and
0 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,4 @@ | ||
Blocks | ||
====== | ||
|
||
This module is only here to ensure some backwards compatibility and encourage Plugin Authors to update the `wp.blocks.*` usage to `wp.editor.*` |
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,43 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
export { | ||
source, | ||
createBlock, | ||
switchToBlockType, | ||
parse, | ||
pasteHandler, | ||
serialize, | ||
getBlockDefaultClassname, | ||
getCategories, | ||
unregisterBlockType, | ||
setUnknownTypeHandlerName, | ||
getUnknownTypeHandlerName, | ||
setDefaultBlockName, | ||
getDefaultBlockName, | ||
getBlockType, | ||
getBlockTypes, | ||
AlignmentToolbar, | ||
BlockAlignmentToolbar, | ||
BlockControls, | ||
BlockDescription, | ||
BlockIcon, | ||
ColorPalette, | ||
Editable, | ||
InspectorControls, | ||
MediaUploadButton, | ||
UrlInput, | ||
UrlInputButton, | ||
} from '@wordpress/editor'; | ||
|
||
import { registerBlockType as oldRegisterBlockType } from '@wordpress/editor'; | ||
|
||
const wrapWithDeprecationWarning = ( func ) => function() { | ||
console.warn( // eslint-disable-line no-console | ||
'The "wp.blocks" module has been deprecated and replaced by "wp.editor". please update your usage.' + | ||
' Example: wp.editor.registerBlock instead of wp.blocks.registerBlock' | ||
); | ||
return func( ...arguments ); | ||
}; | ||
|
||
export const registerBlockType = wrapWithDeprecationWarning( oldRegisterBlockType ); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ const entryPointNames = [ | |
'element', | ||
'i18n', | ||
'utils', | ||
'blocks', | ||
]; | ||
|
||
const externals = { | ||
|