Skip to content

Commit

Permalink
Merge branch 'trunk' into try/nav-area-block
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel authored Nov 4, 2021
2 parents 351f92d + 194d0b9 commit d535b49
Show file tree
Hide file tree
Showing 164 changed files with 2,822 additions and 1,449 deletions.
12 changes: 6 additions & 6 deletions docs/how-to-guides/themes/create-block-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ To enable border styles, add a `border` object under `settings` with the followi
"settings": {
"border": {
"color": true,
"customRadius": true,
"radius": true,
"style": true,
"width": true
}
Expand All @@ -456,7 +456,7 @@ To enable link colors, add a `color` setting and set `link` to true:
"settings": {
"border": {
"color": true,
"customRadius": true,
"radius": true,
"style": true,
"width": true
},
Expand All @@ -475,16 +475,16 @@ To enable padding, margin and custom spacing units, include a setting for spacin
"settings": {
"border": {
"color": true,
"customRadius": true,
"radius": true,
"style": true,
"width": true
},
"color": {
"link": true
},
"spacing": {
"customPadding": true,
"customMargin": true,
"padding": true,
"margin": true,
"units": [ "px", "em", "rem", "vh", "vw" ]
}
}
Expand All @@ -501,7 +501,7 @@ If you want to disable gradients, which are enabled by default, set `gradient` t
"settings": {
"border": {
"color": true,
"customRadius": true,
"radius": true,
"style": true,
"width": true
},
Expand Down
12 changes: 6 additions & 6 deletions docs/how-to-guides/themes/theme-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ The settings section has the following structure:
"settings": {
"border": {
"color": false,
"customRadius": false,
"radius": false,
"style": false,
"width": false
},
Expand All @@ -242,19 +242,19 @@ The settings section has the following structure:
},
"spacing": {
"blockGap": null,
"customMargin": false,
"customPadding": false,
"margin": false,
"padding": false,
"units": [ "px", "em", "rem", "vh", "vw" ]
},
"typography": {
"customFontSize": true,
"customLineHeight": false,
"dropCap": true,
"fontFamilies": [],
"fontSizes": [],
"fontStyle": true,
"fontWeight": true,
"letterSpacing": true,
"lineHeight": false,
"textDecoration": true,
"textTransform": true
},
Expand Down Expand Up @@ -286,8 +286,8 @@ To retain backward compatibility, the existing `add_theme_support` declarations

| add_theme_support | theme.json setting |
| --------------------------- | --------------------------------------------------------- |
| `custom-line-height` | Set `typography.customLineHeight` to `true`. |
| `custom-spacing` | Set `spacing.customPadding` to `true`. |
| `custom-line-height` | Set `typography.lineHeight` to `true`. |
| `custom-spacing` | Set `spacing.padding` to `true`. |
| `custom-units` | Provide the list of units via `spacing.units`. |
| `disable-custom-colors` | Set `color.custom` to `false`. |
| `disable-custom-font-sizes` | Set `typography.customFontSize` to `false`. |
Expand Down
28 changes: 26 additions & 2 deletions docs/reference-guides/block-api/block-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Starting in WordPress 5.8 release, we encourage using the `block.json` metadata
},
"editorScript": "file:./build/index.js",
"script": "file:./build/script.js",
"viewScript": "file:./build/view.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style.css"
}
Expand Down Expand Up @@ -262,7 +263,7 @@ Sometimes a block could have aliases that help users discover it while searching
- Optional
- Localized: No
- Property: `version`
- Since: `5.8.0`
- Since: `WordPress 5.8.0`

```json
{ "version": "1.0.3" }
Expand All @@ -276,6 +277,7 @@ The current version number of the block, such as 1.0 or 1.0.3. It's similar to h
- Optional
- Localized: No
- Property: `textdomain`
- Since: `WordPress 5.7.0`

```json
{ "textdomain": "my-plugin" }
Expand Down Expand Up @@ -427,7 +429,21 @@ Block type editor script definition. It will only be enqueued in the context of
{ "script": "file:./build/script.js" }
```

Block type frontend script definition. It will be enqueued both in the editor and when viewing the content on the front of the site.
Block type frontend and editor script definition. It will be enqueued both in the editor and when viewing the content on the front of the site.

### View Script

- Type: `string` ([WPDefinedAsset](#WPDefinedAsset))
- Optional
- Localized: No
- Property: `viewScript`
- Since: `WordPress 5.9.0`

```json
{ "script": "file:./build/view.js" }
```

Block type frontend script definition. It will be enqueued only when viewing the content on the front of the site.

### Editor Style

Expand Down Expand Up @@ -514,6 +530,14 @@ return array(
);
```

### Frontend Enqueueing

Starting in the WordPress 5.8 release, it is possible to instruct WordPress to enqueue scripts and styles for a block type only when rendered on the frontend. It applies to the following asset fields in the `block.json` file:

- `script`
- `viewScript` (when the block defines `render_callback` during registration in PHP, then the block author is responsible for enqueuing the script)
- `style`

## Internationalization

WordPress string discovery system can automatically translate fields marked in this document as translatable. First, you need to set the `textdomain` property in the `block.json` file that provides block metadata.
Expand Down
104 changes: 52 additions & 52 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,59 +53,59 @@ function gutenberg_reregister_core_block_types() {
'embed',
),
'block_names' => array(
'archives.php' => 'core/archives',
'block.php' => 'core/block',
'calendar.php' => 'core/calendar',
'categories.php' => 'core/categories',
'file.php' => 'core/file',
'latest-comments.php' => 'core/latest-comments',
'latest-posts.php' => 'core/latest-posts',
'loginout.php' => 'core/loginout',
'navigation.php' => 'core/navigation',
'archives.php' => 'core/archives',
'block.php' => 'core/block',
'calendar.php' => 'core/calendar',
'categories.php' => 'core/categories',
'comment-author-avatar.php' => 'core/comment-author-avatar',
'comment-author-name.php' => 'core/comment-author-name',
'comment-content.php' => 'core/comment-content',
'comment-date.php' => 'core/comment-date',
'comment-edit-link.php' => 'core/comment-edit-link',
'comment-reply-link.php' => 'core/comment-reply-link',
'comment-template.php' => 'core/comment-template',
'file.php' => 'core/file',
'home-link.php' => 'core/home-link',
'latest-comments.php' => 'core/latest-comments',
'latest-posts.php' => 'core/latest-posts',
'loginout.php' => 'core/loginout',
'navigation.php' => 'core/navigation',
'navigation-area.php' => 'core/navigation-area',
'navigation-link.php' => 'core/navigation-link',
'navigation-submenu.php' => 'core/navigation-submenu',
'home-link.php' => 'core/home-link',
'rss.php' => 'core/rss',
'search.php' => 'core/search',
'shortcode.php' => 'core/shortcode',
'social-link.php' => 'core/social-link',
'tag-cloud.php' => 'core/tag-cloud',
'page-list.php' => 'core/page-list',
'pattern.php' => 'core/pattern',
'post-author.php' => 'core/post-author',
'post-comment.php' => 'core/post-comment',
'post-comment-author.php' => 'core/post-comment-author',
'post-comment-author-avatar.php' => 'core/post-comment-author-avatar',
'post-comment-content.php' => 'core/post-comment-content',
'post-comment-date.php' => 'core/post-comment-date',
'post-comment-edit.php' => 'core/post-comment-edit',
'post-comment-reply-link.php' => 'core/post-comment-reply-link',
'post-comments.php' => 'core/post-comments',
'post-comments-count.php' => 'core/post-comments-count',
'post-comments-form.php' => 'core/post-comments-form',
'post-comments-link.php' => 'core/post-comments-link',
'comment-template.php' => 'core/comment-template',
'post-content.php' => 'core/post-content',
'post-date.php' => 'core/post-date',
'post-excerpt.php' => 'core/post-excerpt',
'post-featured-image.php' => 'core/post-featured-image',
'post-terms.php' => 'core/post-terms',
'post-navigation-link.php' => 'core/post-navigation-link',
'post-title.php' => 'core/post-title',
'query.php' => 'core/query',
'post-template.php' => 'core/post-template',
'query-title.php' => 'core/query-title',
'query-pagination.php' => 'core/query-pagination',
'query-pagination-next.php' => 'core/query-pagination-next',
'query-pagination-numbers.php' => 'core/query-pagination-numbers',
'query-pagination-previous.php' => 'core/query-pagination-previous',
'site-logo.php' => 'core/site-logo',
'site-tagline.php' => 'core/site-tagline',
'site-title.php' => 'core/site-title',
// 'table-of-contents.php' => 'core/table-of-contents',
'template-part.php' => 'core/template-part',
'term-description.php' => 'core/term-description',
'navigation-link.php' => 'core/navigation-link',
'navigation-submenu.php' => 'core/navigation-submenu',
'page-list.php' => 'core/page-list',
'pattern.php' => 'core/pattern',
'post-author.php' => 'core/post-author',
'post-comment.php' => 'core/post-comment',
'post-comments.php' => 'core/post-comments',
'post-comments-count.php' => 'core/post-comments-count',
'post-comments-form.php' => 'core/post-comments-form',
'post-comments-link.php' => 'core/post-comments-link',
'post-content.php' => 'core/post-content',
'post-date.php' => 'core/post-date',
'post-excerpt.php' => 'core/post-excerpt',
'post-featured-image.php' => 'core/post-featured-image',
'post-navigation-link.php' => 'core/post-navigation-link',
'post-terms.php' => 'core/post-terms',
'post-title.php' => 'core/post-title',
'query.php' => 'core/query',
'post-template.php' => 'core/post-template',
'query-pagination.php' => 'core/query-pagination',
'query-pagination-next.php' => 'core/query-pagination-next',
'query-pagination-numbers.php' => 'core/query-pagination-numbers',
'query-pagination-previous.php' => 'core/query-pagination-previous',
'query-title.php' => 'core/query-title',
'rss.php' => 'core/rss',
'search.php' => 'core/search',
'shortcode.php' => 'core/shortcode',
'social-link.php' => 'core/social-link',
'site-logo.php' => 'core/site-logo',
'site-tagline.php' => 'core/site-tagline',
'site-title.php' => 'core/site-title',
// 'table-of-contents.php' => 'core/table-of-contents',
'tag-cloud.php' => 'core/tag-cloud',
'template-part.php' => 'core/template-part',
'term-description.php' => 'core/term-description',
),
),
__DIR__ . '/../build/edit-widgets/blocks/' => array(
Expand Down
Loading

0 comments on commit d535b49

Please sign in to comment.