@wordpress/create-block-interactive-template 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/block-templates/index.js.mustache +0 -8
- package/block-templates/render.php.mustache +12 -5
- package/index.js +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
1
|
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 1.2.0 (2023-08-10)
|
|
6
|
+
|
|
7
|
+
### Enhancement
|
|
8
|
+
|
|
9
|
+
- Moves the `example` property into block.json by leveraging changes to create-block to now support `example`. [#52801](https://github.com/WordPress/gutenberg/pull/52801)
|
|
@@ -28,14 +28,6 @@ import metadata from './block.json';
|
|
|
28
28
|
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
|
|
29
29
|
*/
|
|
30
30
|
registerBlockType( metadata.name, {
|
|
31
|
-
/**
|
|
32
|
-
* Used to construct a preview for the block to be shown in the block inserter.
|
|
33
|
-
*/
|
|
34
|
-
example: {
|
|
35
|
-
attributes: {
|
|
36
|
-
message: '{{title}}',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
31
|
/**
|
|
40
32
|
* @see ./edit.js
|
|
41
33
|
*/
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{{#isBasicVariant}}
|
|
2
2
|
<?php
|
|
3
3
|
/**
|
|
4
|
+
* PHP file to use when rendering the block type on the server to show on the front end.
|
|
5
|
+
*
|
|
6
|
+
* The following variables are exposed to the file:
|
|
7
|
+
* $attributes (array): The block attributes.
|
|
8
|
+
* $content (string): The block default content.
|
|
9
|
+
* $block (WP_Block): The block instance.
|
|
10
|
+
*
|
|
4
11
|
* @see https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#render
|
|
5
12
|
*/
|
|
6
13
|
|
|
@@ -16,18 +23,18 @@ $unique_id = uniqid( 'p-' );
|
|
|
16
23
|
<button
|
|
17
24
|
data-wp-on--click="actions.{{namespace}}.toggle"
|
|
18
25
|
data-wp-bind--aria-expanded="context.{{namespace}}.isOpen"
|
|
19
|
-
aria-controls="p-<?php echo $unique_id; ?>"
|
|
26
|
+
aria-controls="p-<?php echo esc_attr( $unique_id ); ?>"
|
|
20
27
|
>
|
|
21
|
-
<?php
|
|
28
|
+
<?php esc_html_e( 'Toggle', '{{textdomain}}' ); ?>
|
|
22
29
|
</button>
|
|
23
30
|
|
|
24
31
|
<p
|
|
25
|
-
id="p-<?php echo $unique_id; ?>"
|
|
32
|
+
id="p-<?php echo esc_attr( $unique_id ); ?>"
|
|
26
33
|
data-wp-bind--hidden="!context.{{namespace}}.isOpen"
|
|
27
34
|
>
|
|
28
35
|
<?php
|
|
29
|
-
|
|
36
|
+
esc_html_e( '{{title}} - hello from an interactive block!', '{{textdomain}}' );
|
|
30
37
|
?>
|
|
31
38
|
</p>
|
|
32
39
|
</div>
|
|
33
|
-
{{/isBasicVariant}}
|
|
40
|
+
{{/isBasicVariant}}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/create-block-interactive-template",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Template for @wordpress/create-block to create interactive blocks with the Interactivity API.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
|
|
26
26
|
}
|