-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into feature/debug-plugins
# Conflicts: # composer.lock
- Loading branch information
Showing
85 changed files
with
20,333 additions
and
84,262 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
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,3 @@ | ||
{ | ||
"extends": ["@10up/eslint-config/wordpress"] | ||
} |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
12 | ||
18 |
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,5 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
] | ||
} |
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,19 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"eslint.format.enable": true, | ||
"eslint.workingDirectories": [{ "mode": "auto" }], | ||
"[javascript]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"[javascriptreact]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"[typescriptreact]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
bin/create-block-template/block-templates/edit.js.mustache
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 @@ | ||
{{#isDefaultVariant}} | ||
import { useBlockProps } from '@wordpress/block-editor'; | ||
{{/isDefaultVariant}} | ||
{{#isInnerBlocksVariant}} | ||
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor'; | ||
{{/isInnerBlocksVariant}} | ||
|
||
export const BlockEdit = (props) => { | ||
const { attributes, setAttributes } = props; | ||
const blockProps = useBlockProps(); | ||
{{#isInnerBlocksVariant}} | ||
const innerBlocksProps = useInnerBlocksProps({}, {}); | ||
{{/isInnerBlocksVariant}} | ||
return ( | ||
<div {...blockProps}> | ||
{{#isInnerBlocksVariant}} | ||
<ul {...innerBlocksProps} /> | ||
{{/isInnerBlocksVariant}} | ||
</div> | ||
); | ||
}; |
17 changes: 17 additions & 0 deletions
17
bin/create-block-template/block-templates/index.js.mustache
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,17 @@ | ||
import { registerBlockType } from '@wordpress/blocks'; | ||
{{#isInnerBlocksVariant}} | ||
import { InnerBlocks } from '@wordpress/block-editor'; | ||
{{/isInnerBlocksVariant}} | ||
|
||
import { BlockEdit } from './edit'; | ||
import metadata from './block.json'; | ||
|
||
registerBlockType(metadata, { | ||
edit: BlockEdit, | ||
{{#isDefaultVariant}} | ||
save: () => null, | ||
{{/isDefaultVariant}} | ||
{{#isInnerBlocksVariant}} | ||
save: () => <InnerBlocks.Content />, | ||
{{/isInnerBlocksVariant}} | ||
}); |
33 changes: 33 additions & 0 deletions
33
bin/create-block-template/block-templates/markup.php.mustache
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,33 @@ | ||
<?php | ||
/** | ||
* {{namespace}} markup | ||
* | ||
* @package tenup\Blocks\{{namespaceSnakeCase}} | ||
* | ||
* @var array $attributes Block attributes. | ||
* @var string $content Block content. | ||
* @var WP_Block $block Block instance. | ||
*/ | ||
|
||
?> | ||
|
||
<div <?php echo get_block_wrapper_attributes(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | ||
{{#isInnerBlocksVariant}} | ||
<ul> | ||
<?php | ||
/* | ||
* the block_content is the html generated from innerBlocks | ||
* it is being created from the save method in JS or the render_callback | ||
* in php and is sanitized. | ||
* | ||
* Re sanitizing it through `wp_kses_post` causes | ||
* embed blocks to break and other core filters don't apply. | ||
* therefore no additional sanitization is done and it is being output as is | ||
* | ||
* @see https://github.com/10up/gutenberg-best-practices/discussions/6 | ||
*/ | ||
echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
?> | ||
</ul> | ||
{{/isInnerBlocksVariant}} | ||
</div> |
10 changes: 10 additions & 0 deletions
10
bin/create-block-template/block-templates/style.css.mustache
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 @@ | ||
/** | ||
* The following styles get applied both on the front of your site | ||
* and in the editor. | ||
* | ||
* Replace them with your own styles or remove the file completely. | ||
*/ | ||
|
||
.wp-block-{{namespace}}-{{slug}} { | ||
} |
14 changes: 14 additions & 0 deletions
14
bin/create-block-template/block-templates/view.js.mustache
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,14 @@ | ||
{{#isWithViewScriptVariant}} | ||
/** | ||
* setup an instance of the block | ||
* | ||
* @param {HTMLElement} element DOM Node of the block | ||
* @returns {void} | ||
*/ | ||
function setup{{slugPascalCase}}Block(element) { | ||
} | ||
|
||
const all{{slugPascalCase}}Blocks = document.querySelectorAll('.wp-block-{{namespace}}-{{slug}}'); | ||
all{{slugPascalCase}}Blocks.forEach(setup{{slugPascalCase}}Block); | ||
{{/isWithViewScriptVariant}} |
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,36 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const { join } = require('path'); | ||
|
||
module.exports = { | ||
defaultValues: { | ||
slug: 'example-block', | ||
category: 'text', | ||
title: 'Example Block', | ||
description: 'Example Block', | ||
attributes: {}, | ||
supports: { | ||
html: false, | ||
}, | ||
customBlockJSON: { | ||
textdomain: 'tenup', | ||
}, | ||
namespace: 'tenup', | ||
wpScripts: false, | ||
wpEnv: false, | ||
version: false, | ||
folderName: './src/blocks/example-block', | ||
render: 'file:./markup.php', | ||
editorStyle: false, | ||
style: 'file:./style.css', | ||
}, | ||
variants: { | ||
default: {}, | ||
innerBlocks: {}, | ||
withViewScript: { | ||
viewScript: 'file:./view.js', | ||
}, | ||
}, | ||
blockTemplatesPath: join(__dirname, 'block-templates'), | ||
}; |
Oops, something went wrong.