Skip to content
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

[WIP] Update/build individual blocks #6087

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
596372a
Framework: Per-block script bundles
aduth Feb 2, 2018
459a2be
Server-side registration for heading core block
Apr 2, 2018
c435943
Server-side registration for more core blocks
Apr 2, 2018
ffb5594
Server-side registration for core dynamic blocks
Apr 3, 2018
13fc4d7
Server-side registration for embed and table blocks
Apr 3, 2018
17d6e28
Server-side registration for image block
Apr 3, 2018
8d5c588
Updated WebPack configuration to generate different CSS files for eac…
Apr 5, 2018
e5e7ce9
Enqueued base structural styles for blocks separately on server-side
Apr 5, 2018
c41d21a
Enqueued editor-specific styles for blocks separately on server-side
Apr 6, 2018
fd3aab2
Removed 'wp-edit-blocks' style registration
Apr 8, 2018
439be0d
Resolved merge conflicts to merge branch 'master' into update/build-i…
Apr 8, 2018
50ee194
Resolved conflicts to merge master into update/build-individual-blocks
Apr 9, 2018
ef8c868
Modified Webpack configuration to use separate CSS loader for each bl…
Apr 9, 2018
191561e
Undid tuples configuration for entry points in Webpack Configuration
Apr 9, 2018
0dc5a6e
Changed relative paths of style, editor_style and editor_script attri…
Apr 9, 2018
4764672
Fixed relative paths of coreData.js and viewport.js in client-assets.php
Apr 9, 2018
f12b5b6
Server-side registration for nextpage and columns blocks
Apr 9, 2018
272bb03
Removed import for "setDefaultBlockName" in heading block's JavaScript
Apr 9, 2018
29389ee
Fixed syntax errors by running 'npm run lint:fix'
Apr 9, 2018
f0b0f68
Fixed errors brought up by npm run lint:fix
Apr 10, 2018
e9e050c
Changed Webpack configuration to change output folder for individual …
Apr 10, 2018
6458575
Fixed conflicts to merge master into this branch
Apr 10, 2018
818e8cb
Renamed style.scss in blocks/library/block to editor.scss since it lo…
Apr 10, 2018
f1931aa
Renamed style.scss to editor.scss for core/block in index.js as well
Apr 10, 2018
02812b4
Specified dependencies for editor_style handles for individual blocks
Apr 10, 2018
8b81c4b
Merge remote-tracking branch 'upstream/master' into update/build-indi…
Apr 11, 2018
a37b38c
Merge remote-tracking branch 'upstream/master' into update/build-indi…
Apr 11, 2018
28727b0
Fixed issues in Webpack configuration
Apr 11, 2018
21dc8d7
Imported core block library dependencies externally in individual blo…
Apr 12, 2018
8c86c0e
Prevented exports for individual block libraries as Externals in Webp…
Apr 12, 2018
c3bf694
Merge remote-tracking branch 'upstream/master' into update/build-indi…
Apr 12, 2018
f2eb736
Exported ContrastChecker and imported it as an external module inside…
Apr 12, 2018
d502c51
Imported AutoCompleters as external dependencies in paragraph block code
Apr 12, 2018
3b72760
Resolved conflicts to merge master in current branch
Apr 12, 2018
80520c6
Merge remote-tracking branch 'upstream/master' into update/build-indi…
Apr 13, 2018
eb460d8
Merge branch 'master' into update/build-individual-blocks
Apr 14, 2018
8d7cf3b
Added documentation blocks for individual block registration function…
Apr 14, 2018
46d1905
Server-side registration for core-embed/ block types
Apr 15, 2018
ba78892
Exported DefaultAutoCompleters from Hooks so that it can be imported …
Apr 15, 2018
c151f06
Merge remote-tracking branch 'upstream/master' into update/build-indi…
Apr 15, 2018
2e284ee
Resolved conflicts to merge master into this branch
Apr 17, 2018
6ee0a8c
Merge branch 'master' into update/build-individual-blocks
Apr 17, 2018
7611a65
Resolved conflicts to merge master into this branch
Apr 18, 2018
d7dada4
Exported name and settings of each core block since they are needed f…
Apr 18, 2018
d2fad25
Resolved conflict to merge master into this branch
Apr 19, 2018
16dfb71
Fixed unit tests through new registerCoreBlocks() helper function
Apr 19, 2018
53926f4
Imported the 'fs' object rather than only readdirSync from it
Apr 19, 2018
addc03f
Fixed regression: called setUnknownTypeHandlerName for freeForm block
Apr 19, 2018
5b17af6
Excluded hidden folders from output of fs.readdirSync
Apr 19, 2018
4a72120
Imported registerCoreBlocks as an internal dependency (not external) …
Apr 19, 2018
0607378
Fixed syntax errors reported by ESLINT
Apr 19, 2018
a04a774
Fixed URLs of CSS bundles for modules
Apr 19, 2018
fe922bc
Excluded files from fs.readdirSync in registerCoreBlocks() function
Apr 20, 2018
de3f805
Resolved conflicts to merge master into this branch
Apr 20, 2018
0d1c784
Fixed syntax error reported by ESLINT
Apr 20, 2018
0542783
Merge remote-tracking branch 'upstream/master' into update/build-indi…
Apr 23, 2018
3cab411
Resolved conflicts to merge master in this branch
Apr 23, 2018
e0efb0e
Changed the path of "build" folder for Gutenberg to confirm if npm bu…
Apr 23, 2018
973ac4a
Resolved conflicts to merge master in this branch
May 2, 2018
75ca903
Resolved conflicts to merge master in this branch
May 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion blocks/api/raw-handling/test/integration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import path from 'path';
/**
* Internal dependencies
*/
import { registerCoreBlocks } from '../../../../../core-blocks';
import rawHandler from '../../index';
import serialize from '../../../serializer';

import { registerCoreBlocks } from '../../../../test/helpers';

const types = [
'plain',
'classic',
Expand All @@ -35,6 +36,7 @@ describe( 'raw handling: integration', () => {
beforeAll( () => {
// Load all hooks that modify blocks
require( 'blocks/hooks' );

registerCoreBlocks();
} );

Expand Down
2 changes: 2 additions & 0 deletions blocks/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ import './custom-class-name';
import './default-autocompleters';
import './generated-class-name';
import './layout';

export { defaultAutocompleters } from './default-autocompleters';
2 changes: 2 additions & 0 deletions blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export * from './colors';
export { default as editorMediaUpload } from './editor-media-upload';
export { default as AlignmentToolbar } from './alignment-toolbar';
export { default as Autocomplete } from './autocomplete';
export { blockAutocompleter, userAutocompleter } from './autocompleters';
export { default as BlockAlignmentToolbar } from './block-alignment-toolbar';
export { default as BlockControls } from './block-controls';
export { default as BlockFormatControls } from './block-format-controls';
export { default as BlockEdit } from './block-edit';
export { default as BlockIcon } from './block-icon';
export { default as ColorPalette } from './color-palette';
export { default as ContrastChecker } from './contrast-checker';
export { defaultAutocompleters } from './hooks';
export { default as ImagePlaceholder } from './image-placeholder';
export { default as InnerBlocks } from './inner-blocks';
export { default as InspectorControls } from './inspector-controls';
Expand Down
45 changes: 45 additions & 0 deletions blocks/library/audio/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Server-side registration of the `core/audio` block.
*
* @package gutenberg
*/

/**
* Registers the `core/audio` block on the server-side.
*
* @since 2.7.0
*/
function register_core_audio_block() {
wp_register_script(
'core-audio-block',
gutenberg_url( '/build/__block_audio.js' ),
array( 'wp-blocks', 'wp-i18n', 'wp-components', 'wp-element', 'wp-utils' )
);

wp_register_style(
'core-audio-block',
gutenberg_url( '/build/__block_audio.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_audio.css' )
);

wp_style_add_data( 'core-audio-block', 'rtl', 'replace' );

wp_register_style(
'core-audio-block-editor',
gutenberg_url( '/build/__block_audio_editor.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_audio_editor.css' )
);

wp_style_add_data( 'core-audio-block-editor', 'rtl', 'replace' );

register_block_type( 'core/audio', array(
'style' => 'core-audio-block',
'editor_style' => 'core-audio-block-editor',
'editor_script' => 'core-audio-block',
) );
}

add_action( 'init', 'register_core_audio_block' );
45 changes: 45 additions & 0 deletions blocks/library/button/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Server-side registration of the `core/button` block.
*
* @package gutenberg
*/

/**
* Registers the `core/button` block on the server-side.
*
* @since 2.7.0
*/
function register_core_button_block() {
wp_register_script(
'core-button-block',
gutenberg_url( '/build/__block_button.js' ),
array( 'wp-blocks', 'wp-i18n', 'wp-components', 'wp-element' )
);

wp_register_style(
'core-button-block',
gutenberg_url( '/build/__block_button.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_button.css' )
);

wp_style_add_data( 'core-button-block', 'rtl', 'replace' );

wp_register_style(
'core-button-block-editor',
gutenberg_url( '/build/__block_button_editor.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_button_editor.css' )
);

wp_style_add_data( 'core-button-block-editor', 'rtl', 'replace' );

register_block_type( 'core/button', array(
'style' => 'core-button-block',
'editor_style' => 'core-button-block-editor',
'editor_script' => 'core-button-block',
) );
}

add_action( 'init', 'register_core_button_block' );
35 changes: 35 additions & 0 deletions blocks/library/code/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Server-side registration of the `core/code` block.
*
* @package gutenberg
*/

/**
* Registers the `core/code` block on the server-side.
*
* @since 2.7.0
*/
function register_core_code_block() {
wp_register_script(
'core-code-block',
gutenberg_url( '/build/__block_code.js' ),
array( 'wp-blocks', 'wp-i18n' )
);

wp_register_style(
'core-code-block-editor',
gutenberg_url( '/build/__block_code_editor.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_code_editor.css' )
);

wp_style_add_data( 'core-code-block-editor', 'rtl', 'replace' );

register_block_type( 'core/code', array(
'editor_style' => 'core-code-block-editor',
'editor_script' => 'core-code-block',
) );
}

add_action( 'init', 'register_core_code_block' );
45 changes: 45 additions & 0 deletions blocks/library/columns/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Server-side registration of the `core/columns` block.
*
* @package gutenberg
*/

/**
* Registers the `core/columns` block on the server-side.
*
* @since 2.7.0
*/
function register_core_columns_block() {
wp_register_script(
'core-columns-block',
gutenberg_url( '/build/__block_columns.js' ),
array( 'wp-blocks', 'wp-i18n', 'wp-components' )
);

wp_register_style(
'core-columns-block',
gutenberg_url( '/build/__block_columns.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_columns.css' )
);

wp_style_add_data( 'core-columns-block', 'rtl', 'replace' );

wp_register_style(
'core-columns-block-editor',
gutenberg_url( '/build/__block_columns_editor.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_columns_editor.css' )
);

wp_style_add_data( 'core-columns-block-editor', 'rtl', 'replace' );

register_block_type( 'core/columns', array(
'style' => 'core-columns-block',
'editor_style' => 'core-columns-block-editor',
'editor_script' => 'core-columns-block',
) );
}

add_action( 'init', 'register_core_columns_block' );
45 changes: 45 additions & 0 deletions blocks/library/cover-image/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Server-side registration of the `core/cover-image` block.
*
* @package gutenberg
*/

/**
* Registers the `core/cover-image` block on the server-side.
*
* @since 2.7.0
*/
function register_core_cover_image_block() {
wp_register_script(
'core-cover-image-block',
gutenberg_url( '/build/__block_coverImage.js' ),
array( 'wp-blocks', 'wp-i18n', 'wp-components' )
);

wp_register_style(
'core-cover-image-block',
gutenberg_url( '/build/__block_coverImage.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_coverImage.css' )
);

wp_style_add_data( 'core-cover-image-block', 'rtl', 'replace' );

wp_register_style(
'core-cover-image-block-editor',
gutenberg_url( '/build/__block_coverImage_editor.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_coverImage_editor.css' )
);

wp_style_add_data( 'core-cover-image-block-editor', 'rtl', 'replace' );

register_block_type( 'core/cover-image', array(
'style' => 'core-cover-image-block',
'editor_style' => 'core-cover-image-block-editor',
'editor_script' => 'core-cover-image-block',
) );
}

add_action( 'init', 'register_core_cover_image_block' );
101 changes: 101 additions & 0 deletions blocks/library/embed/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php
/**
* Server-side registration of `core/embed` and `core-embed/` block types.
*
* @package gutenberg
*/

/**
* Registers the `core/embed` block on the server-side.
*
* @since 2.7.0
*/
function register_core_embed_block_types() {

$common_embed_block_types = array(
'core-embed/twitter',
'core-embed/youtube',
'core-embed/facebook',
'core-embed/instagram',
'core-embed/wordpress',
'core-embed/soundcloud',
'core-embed/spotify',
'core-embed/flickr',
'core-embed/vimeo',
);

$other_embed_block_types = array(
'core-embed/animoto',
'core-embed/cloudup',
'core-embed/collegehumor',
'core-embed/dailymotion',
'core-embed/funnyordie',
'core-embed/hulu',
'core-embed/imgur',
'core-embed/issuu',
'core-embed/kickstarter',
'core-embed/meetup-com',
'core-embed/mixcloud',
'core-embed/photobucket',
'core-embed/polldaddy',
'core-embed/reddit',
'core-embed/reverbnation',
'core-embed/screencast',
'core-embed/scribd',
'core-embed/slideshare',
'core-embed/smugmug',
'core-embed/speaker',
'core-embed/ted',
'core-embed/tumblr',
'core-embed/videopress',
'core-embed/wordpress-tv',
);

wp_register_script(
'core-embed-block',
gutenberg_url( '/build/__block_embed.js' ),
array( 'wp-blocks', 'wp-i18n', 'wp-components', 'wp-element' )
);

wp_register_style(
'core-embed-block',
gutenberg_url( '/build/__block_embed.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_embed.css' )
);

wp_style_add_data( 'core-embed-block', 'rtl', 'replace' );

wp_register_style(
'core-embed-block-editor',
gutenberg_url( '/build/__block_embed_editor.css' ),
array(),
filemtime( gutenberg_dir_path() . 'build/__block_embed_editor.css' )
);

wp_style_add_data( 'core-embed-block-editor', 'rtl', 'replace' );

register_block_type( 'core/embed', array(
'style' => 'core-embed-block',
'editor_style' => 'core-embed-block-editor',
'editor_script' => 'core-embed-block',
) );

foreach ( $common_embed_block_types as $embed_block_type_name ) {
register_block_type( $embed_block_type_name, array(
'style' => 'core-embed-block',
'editor_style' => 'core-embed-block-editor',
'editor_script' => 'core-embed-block',
) );
}

foreach ( $other_embed_block_types as $embed_block_type_name ) {
register_block_type( $embed_block_type_name, array(
'style' => 'core-embed-block',
'editor_style' => 'core-embed-block-editor',
'editor_script' => 'core-embed-block',
) );
}
}

add_action( 'init', 'register_core_embed_block_types' );
Loading