diff --git a/src/plugins/example-blocks/blocks/hello-world/block.json b/src/plugins/example-blocks/blocks/hello-world/block.json index 3fcdf1a..1e7bd06 100644 --- a/src/plugins/example-blocks/blocks/hello-world/block.json +++ b/src/plugins/example-blocks/blocks/hello-world/block.json @@ -1,17 +1,17 @@ { - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 3, - "name": "example-blocks/hello-world", - "version": "0.1.0", - "title": "Hello World", - "category": "widgets", - "icon": "nametag", - "description": "Prints Hello World!", - "supports": { - "html": false - }, - "textdomain": "example-blocks", - "editorScript": "file:./build/index.js", - "editorStyle": "file:./build/index.css", - "style": "file:./build/style-index.css" + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "example-blocks/hello-world", + "version": "0.1.0", + "title": "Hello World", + "category": "widgets", + "icon": "nametag", + "description": "Prints Hello World!", + "supports": { + "html": false + }, + "textdomain": "example-blocks", + "editorScript": "file:./build/index.js", + "editorStyle": "file:./build/index.css", + "style": "file:./build/style-index.css" } diff --git a/src/plugins/example-blocks/blocks/hello-world/src/edit.js b/src/plugins/example-blocks/blocks/hello-world/src/edit.js index 0c8ea99..da9bf70 100644 --- a/src/plugins/example-blocks/blocks/hello-world/src/edit.js +++ b/src/plugins/example-blocks/blocks/hello-world/src/edit.js @@ -30,9 +30,5 @@ import './editor.scss'; * @return {WPElement} Element to render. */ export default function Edit() { - return ( -

- { __( 'Hello World!', 'example-blocks' ) } -

- ); + return

{__('Hello World!', 'example-blocks')}

; } diff --git a/src/plugins/example-blocks/blocks/hello-world/src/editor.scss b/src/plugins/example-blocks/blocks/hello-world/src/editor.scss index 6085289..7d5ea81 100644 --- a/src/plugins/example-blocks/blocks/hello-world/src/editor.scss +++ b/src/plugins/example-blocks/blocks/hello-world/src/editor.scss @@ -5,5 +5,6 @@ */ .wp-block-example-blocks-hello-world { + /* insert custom styles here */ } diff --git a/src/plugins/example-blocks/blocks/hello-world/src/save.js b/src/plugins/example-blocks/blocks/hello-world/src/save.js index 703ae8e..1fbca4d 100644 --- a/src/plugins/example-blocks/blocks/hello-world/src/save.js +++ b/src/plugins/example-blocks/blocks/hello-world/src/save.js @@ -16,9 +16,5 @@ import { useBlockProps } from '@wordpress/block-editor'; * @return {WPElement} Element to render. */ export default function save() { - return ( -

- { 'Hello World!' } -

- ); + return

{'Hello World!'}

; } diff --git a/src/plugins/example-blocks/blocks/reverse-string/block.json b/src/plugins/example-blocks/blocks/reverse-string/block.json index 4a10db0..60db5d0 100644 --- a/src/plugins/example-blocks/blocks/reverse-string/block.json +++ b/src/plugins/example-blocks/blocks/reverse-string/block.json @@ -1,17 +1,17 @@ { - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 3, - "name": "example-blocks/reverse-string", - "version": "0.1.0", - "title": "Reverse String", - "category": "widgets", - "icon": "smiley", - "description": "Prints a user-entered string in reverse order.", - "supports": { - "html": false - }, - "textdomain": "example-blocks", - "editorScript": "file:./build/index.js", - "editorStyle": "file:./build/index.css", - "style": "file:./build/style-index.css" + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "example-blocks/reverse-string", + "version": "0.1.0", + "title": "Reverse String", + "category": "widgets", + "icon": "smiley", + "description": "Prints a user-entered string in reverse order.", + "supports": { + "html": false + }, + "textdomain": "example-blocks", + "editorScript": "file:./build/index.js", + "editorStyle": "file:./build/index.css", + "style": "file:./build/style-index.css" } diff --git a/src/plugins/example-blocks/blocks/reverse-string/src/edit.js b/src/plugins/example-blocks/blocks/reverse-string/src/edit.js index 82190c6..6d31701 100644 --- a/src/plugins/example-blocks/blocks/reverse-string/src/edit.js +++ b/src/plugins/example-blocks/blocks/reverse-string/src/edit.js @@ -20,21 +20,20 @@ import './editor.scss'; * The edit function describes the structure of your block in the context of the * editor. This represents what the editor will render when the block is used. * + * @param {Object} props + * @param {Object} props.attributes + * @param {Function} props.setAttributes * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit * * @return {WPElement} Element to render. */ export default function Edit({ attributes, setAttributes }) { const { textToReverse } = attributes; - const updateTextToReverse = textToReverse => setAttributes({ textToReverse }); + const updateTextToReverse = (newText) => setAttributes({ textToReverse: newText }); return (
- +
); } diff --git a/src/plugins/example-blocks/blocks/reverse-string/src/save.js b/src/plugins/example-blocks/blocks/reverse-string/src/save.js index 5bcd58f..042cac0 100644 --- a/src/plugins/example-blocks/blocks/reverse-string/src/save.js +++ b/src/plugins/example-blocks/blocks/reverse-string/src/save.js @@ -11,6 +11,8 @@ import { useBlockProps } from '@wordpress/block-editor'; * be combined into the final markup, which is then serialized by the block * editor into `post_content`. * + * @param {Object} props + * @param {Object} props.attributes * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#save * * @return {WPElement} Element to render. @@ -19,9 +21,5 @@ export default function save({ attributes }) { const { textToReverse } = attributes; const reversedText = textToReverse.split('').reverse().join(''); - return ( -

- {reversedText} -

- ); + return

{reversedText}

; } diff --git a/src/plugins/example-blocks/blocks/reverse-string/src/style.scss b/src/plugins/example-blocks/blocks/reverse-string/src/style.scss index 77d17e0..2889ff2 100644 --- a/src/plugins/example-blocks/blocks/reverse-string/src/style.scss +++ b/src/plugins/example-blocks/blocks/reverse-string/src/style.scss @@ -6,5 +6,6 @@ */ .wp-block-example-blocks-reverse-string { + /* insert custom styles here */ }