-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Packages: Add the blocks module to the packages folder #8046
Changes from 3 commits
5d15583
f2add59
3261f08
5ff5d91
5d904c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,13 @@ function gutenberg_register_scripts_and_styles() { | |
// WordPress packages. | ||
wp_register_script( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array() ); | ||
|
||
wp_register_script( | ||
'wp-autop', | ||
gutenberg_url( 'build/autop/index.js' ), | ||
array(), | ||
filemtime( gutenberg_dir_path() . 'build/autop/index.js' ), | ||
true | ||
); | ||
wp_register_script( | ||
'wp-dom-ready', | ||
gutenberg_url( 'build/dom-ready/index.js' ), | ||
|
@@ -297,10 +304,24 @@ function gutenberg_register_scripts_and_styles() { | |
wp_register_script( | ||
'wp-blocks', | ||
gutenberg_url( 'build/blocks/index.js' ), | ||
array( 'wp-blob', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-shortcode', 'wp-block-serialization-spec-parser', 'wp-data', 'lodash' ), | ||
array( | ||
'wp-autop', | ||
'wp-blob', | ||
'wp-block-serialization-spec-parser', | ||
'wp-data', | ||
'wp-deprecated', | ||
'wp-dom', | ||
'wp-element', | ||
'wp-hooks', | ||
'wp-i18n', | ||
'wp-is-shallow-equal', | ||
'wp-shortcode', | ||
'lodash' | ||
), | ||
filemtime( gutenberg_dir_path() . 'build/blocks/index.js' ), | ||
true | ||
); | ||
|
||
wp_add_inline_script( | ||
'wp-blocks', | ||
gutenberg_get_script_polyfill( array( | ||
|
@@ -1157,7 +1178,10 @@ function gutenberg_editor_scripts_and_styles( $hook ) { | |
); | ||
|
||
// Preload server-registered block schemas. | ||
wp_localize_script( 'wp-blocks', '_wpBlocks', gutenberg_prepare_blocks_for_js() ); | ||
wp_add_inline_script( | ||
'wp-blocks', | ||
'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . json_encode( gutenberg_prepare_blocks_for_js() ) . ');' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, nice 👍 |
||
); | ||
|
||
// Get admin url for handling meta boxes. | ||
$meta_box_url = admin_url( 'post.php' ); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@wordpress/blocks", | ||
"version": "1.0.0-alpha.1", | ||
"description": "Block API for WordPress", | ||
"author": "The WordPress Contributors", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"blocks" | ||
], | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/blocks/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WordPress/gutenberg.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/gutenberg/issues" | ||
}, | ||
"main": "build/index.js", | ||
"module": "build-module/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.0.0-beta.52", | ||
"@wordpress/autop": "file:../autop", | ||
"@wordpress/blob": "file:../blob", | ||
"@wordpress/block-serialization-spec-parser": "file:../block-serialization-spec-parser", | ||
"@wordpress/data": "file:../data", | ||
"@wordpress/deprecated": "file:../deprecated", | ||
"@wordpress/dom": "file:../dom", | ||
"@wordpress/element": "file:../element", | ||
"@wordpress/hooks": "file:../hooks", | ||
"@wordpress/i18n": "file:../i18n", | ||
"@wordpress/is-shallow-equal": "file:../is-shallow-equal", | ||
"@wordpress/shortcode": "file:../shortcode", | ||
"dom-react": "^2.2.1", | ||
"element-closest": "^2.0.2", | ||
"hpq": "^1.2.0", | ||
"lodash": "^4.17.10", | ||
"rememo": "^3.0.0", | ||
"showdown": "^1.8.6", | ||
"simple-html-tokenizer": "^0.4.1", | ||
"tinycolor2": "^1.4.1", | ||
"uuid": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"deep-freeze": "^0.0.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { equal } from 'assert'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just removed assert in favor of Jest built-in asserters in all these tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome, I like this 💯 |
||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
|
@@ -13,6 +8,6 @@ describe( 'blockquoteNormaliser', () => { | |
it( 'should normalise blockquote', () => { | ||
const input = '<blockquote>test</blockquote>'; | ||
const output = '<blockquote><p>test</p></blockquote>'; | ||
equal( deepFilterHTML( input, [ blockquoteNormaliser ] ), output ); | ||
expect( deepFilterHTML( input, [ blockquoteNormaliser ] ) ).toEqual( output ); | ||
} ); | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, autop was not a separate script but was bundled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url
andwordcount
are also bundled into something, I beteditor
oredit-post
.