-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59f4ec3
commit 0dd1355
Showing
12 changed files
with
395 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 2, | ||
"title": "Block Y", | ||
"name": "xywz-blocks/block-y", | ||
"description": "Block Y", | ||
"version": "1.0.0-beta", | ||
"category": "xywz-blocks", | ||
"icon": "rest-api", | ||
"supports": { | ||
"html": true | ||
}, | ||
"attributes": { | ||
"exampleAttribute": { | ||
"type": "string" | ||
} | ||
}, | ||
"keywords": ["basic", "model"], | ||
"editorScript": "file:./build/index.js", | ||
"editorStyle": "file:./src/style.css" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n'), 'version' => '00b087886b1e7ea641f9'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from "react"; | ||
import { __ } from "@wordpress/i18n"; | ||
import { useBlockProps } from "@wordpress/block-editor"; | ||
|
||
function Edit(props) { | ||
function setExampleAttribute(e) { | ||
props.setAttributes({ exampleAttribute: e.target.value }); | ||
} | ||
|
||
return ( | ||
<div {...useBlockProps()}> | ||
<div> | ||
<h4>Block Y</h4> | ||
<p>Insert the attribute value below</p> | ||
<input | ||
type="text" | ||
value={props.attributes.exampleAttribute} | ||
onChange={setExampleAttribute} | ||
placeholder="Attribute value that will be displayed in the frontend" | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Edit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { registerBlockType } from "@wordpress/blocks"; | ||
|
||
import Edit from "./edit"; | ||
import Save from "./save"; | ||
import metadata from "../block.json"; | ||
|
||
registerBlockType(metadata, { | ||
edit: Edit, | ||
save: Save, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { __ } from "@wordpress/i18n"; | ||
import { useBlockProps } from "@wordpress/block-editor"; | ||
|
||
function Save(props) { | ||
return ( | ||
<p {...useBlockProps.save()}> | ||
{__(<div>{props.attributes.exampleAttribute}</div>)} | ||
</p> | ||
); | ||
} | ||
|
||
export default Save; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.