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

Add example block setting to show block preview #93

Merged
merged 2 commits into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion 01-basic-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 01-basic-esnext/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ registerBlockType( 'gutenberg-examples/example-01-basic-esnext', {
title: __( 'Example: Basic (ESNext)', 'gutenberg-examples' ),
icon: 'universal-access-alt',
category: 'layout',
example: {},
edit() {
return (
<div style={ blockStyle }>Hello World, step 1 (from the editor).</div>
Expand Down
1 change: 1 addition & 0 deletions 01-basic/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
title: __( 'Example: Basic', 'gutenberg-examples' ),
icon: 'universal-access-alt',
category: 'layout',
example: {},
edit: function() {
return el(
'p',
Expand Down
1 change: 1 addition & 0 deletions 02-stylesheets/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
title: __( 'Example: Stylesheets', 'gutenberg-examples' ),
icon: 'universal-access-alt',
category: 'layout',
example: {},
edit: function( props ) {
return el(
'p',
Expand Down
2 changes: 1 addition & 1 deletion 03-editable-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'b75d1699b4b5965b3ba33750409e0168');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'e6dd8af0992c4aabf4b0a46b6442249a');
2 changes: 1 addition & 1 deletion 03-editable-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions 03-editable-esnext/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ registerBlockType( 'gutenberg-examples/example-03-editable-esnext', {
selector: 'p',
},
},
example: {
attributes: {
content: __( 'Hello world' )
},
},
edit: ( props ) => {
const { attributes: { content }, setAttributes, className } = props;
const onChangeContent = ( newContent ) => {
Expand Down
6 changes: 6 additions & 0 deletions 03-editable/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
},
},

example: {
attributes: {
content: __( 'Hello world' ),
},
},

edit: function( props ) {
var content = props.attributes.content;
function onChangeContent( newContent ) {
Expand Down
2 changes: 1 addition & 1 deletion 04-controls-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '20b2b3e4b79e1e243a699e81ad954911');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '57d7ec9b925308113dc0232e6ceb5739');
2 changes: 1 addition & 1 deletion 04-controls-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 04-controls-esnext/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ registerBlockType( 'gutenberg-examples/example-04-controls-esnext', {
default: 'none',
},
},
example: {
attributes: {
content: __( 'Hello world' ),
alignment: 'right',
},
},
edit: ( props ) => {
const {
attributes: {
Expand Down
7 changes: 7 additions & 0 deletions 04-controls/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
},
},

example: {
attributes: {
content: __( 'Hello world' ),
alignment: 'right',
},
},

edit: function( props ) {
var content = props.attributes.content;
var alignment = props.attributes.alignment;
Expand Down
2 changes: 1 addition & 1 deletion 05-recipe-card-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '90824b35b3b97a34d30c4e73039d5243');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'd3ceeb82ec8e77817a88bb9215b2aca4');
2 changes: 1 addition & 1 deletion 05-recipe-card-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions 05-recipe-card-esnext/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ registerBlockType( 'gutenberg-examples/example-05-recipe-card-esnext', {
selector: '.steps',
},
},
example: {
attributes: {
title: __( 'Chocolate Chip Cookies', 'gutenberg-examples' ),
mediaURL: 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/2ChocolateChipCookies.jpg/320px-2ChocolateChipCookies.jpg',
ingredients: [
__( 'flour', 'gutenberg-examples' ),
__( 'sugar', 'gutenberg-examples' ),
__( 'chocolate', 'gutenberg-examples' ),
'💖'
],
instructions: [
__( 'Mix', 'gutenberg-examples' ),
__( 'Bake', 'gutenberg-examples' ),
__( 'Enjoy', 'gutenberg-examples' ),
],
},
},
edit: ( props ) => {
const {
className,
Expand Down
Loading