Commit Graph

115 Commits

Author SHA1 Message Date
hellofromTonya 7b880889bc Editor: Sets 'paged' query arg only when there are comments: `build_comment_query_vars_from_block()`.
A SQL syntax error happened when a post has no comments and "Break comments into pages" is checked in Settings > Discussion. The fix sets the `'paged'` query arg only when there are comments. When there are no comments, `WP_Comment_Query` sets the default `'paged'` value to `1`.

Props bernhard-reiter, luisherranz, czapla, cbravobernal, davidbaumwald, hellofromTonya.

Follow-up to [53142], [53138].
Fixes #55658.
Built from https://develop.svn.wordpress.org/trunk@53336


git-svn-id: http://core.svn.wordpress.org/trunk@52925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 14:33:12 +00:00
audrasjb 9d10c963ff Docs: Correct parameter types for `serialize_block()` and `serialize_blocks()`.
This changeset clarifies the expected type for the first parameter passed to `serialize_block()` and `serialize_blocks()` functions.

Props manooweb.
Fixes #55648.
See #54729.

Built from https://develop.svn.wordpress.org/trunk@53332


git-svn-id: http://core.svn.wordpress.org/trunk@52921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 13:32:08 +00:00
John Blackbourn c6dbcf8576 Docs: Various docblock corrections and improvements for changes introduced in 6.0.
See #54729

Built from https://develop.svn.wordpress.org/trunk@53302


git-svn-id: http://core.svn.wordpress.org/trunk@52891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:59:13 +00:00
Peter Wilson 4710282f33 Editor: Show comment previews in the Comment Query Loop.
Update `build_comment_query_vars_from_block()` to show previews of unmoderated comments to the original author of the comment. This duplicates the existing logic in `wp_list_comments()`.

Props darerodz, bernhard-reiter, czapla.
Fixes #55634.


Built from https://develop.svn.wordpress.org/trunk@53298


git-svn-id: http://core.svn.wordpress.org/trunk@52887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 01:18:13 +00:00
audrasjb 6ef5625ac2 Docs: Docs: Use third-person singular verbs for function descriptions in `wp-includes/blocks.php` and `wp-includes/script-loader.php`, per the documentation standards.
See #54729.

Built from https://develop.svn.wordpress.org/trunk@53235


git-svn-id: http://core.svn.wordpress.org/trunk@52824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-20 14:09:11 +00:00
audrasjb 4d3dbe477a Editor: Move `wp_enqueue_block_style()` to `wp-includes/script-loader.php`, for better consistency.
As a result of [52741] and [52743], `wp_enqueue_block_support_styles()` was moved to `wp-includes/script-loader.php`. However, `wp_enqueue_block_style()` was still defined in `wp-includes/blocks.php`. This changeset also moves `wp_enqueue_block_support_styles()` to `wp-includes/script-loader.php` for better consistency.

Follow-up to [52741], [52743].

Props SergeyBiryukov, mukesh27, audrasjb.
Fixes #55182.
See #55148.

Built from https://develop.svn.wordpress.org/trunk@53234


git-svn-id: http://core.svn.wordpress.org/trunk@52823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-20 13:53:16 +00:00
gziolo ec0574144a Editor: Fix Comment Query block isn't lazy loading meta data
Related GitHub issue: https://github.com/WordPress/gutenberg/issues/40241.
Primes comment meta data cache within calls to WP_Comment_Query.

Props peterwilsoncc, cbravobernal.
See #55567.
Follow-up [53138].



Built from https://develop.svn.wordpress.org/trunk@53214


git-svn-id: http://core.svn.wordpress.org/trunk@52803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-19 12:39:09 +00:00
gziolo 83aed3ea4f Code Quality: Fix reported undefined `$script_uri` variable notice
The code editor reported this issue while mamduka was browsing the blocks.php file. PHP considers variables undefined until a value is assigned (or the global keyword is used).

Follow-up for [53091].
Props mamaduka, peterwilsoncc.
See 55567.


Built from https://develop.svn.wordpress.org/trunk@53211


git-svn-id: http://core.svn.wordpress.org/trunk@52800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-19 09:58:07 +00:00
Sergey Biryukov e0d13f8b59 Coding Standards: Correct alignment in various files.
This fixes an `Array double arrow not aligned correctly` WPCS warning.

Follow-up to [53075], [53084], [53091], [53094], [53155], [53129].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@53197


git-svn-id: http://core.svn.wordpress.org/trunk@52786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 15:07:08 +00:00
gziolo 68a36de460 REST API: Bring new endpoints for Block Patterns from Gutenberg plugin
Related Gutenberg issue: https://github.com/WordPress/gutenberg/issues/39889.

Backporting changes from the Gutenberg plugin:
- new Block Patterns REST API endpoint
- new Block Pattern Categories REST API endpoint
- updates to Query Loop related patterns
- support for custom taxonomies in Query Loop block

Props hellofromtonya, peterwilsoncc, ntsekouras, zieladam, ironprogrammer, spacedmonkey, timothyblynjacobs, antonvlasenko, jsnajdr.
See #55505.



Built from https://develop.svn.wordpress.org/trunk@53152


git-svn-id: http://core.svn.wordpress.org/trunk@52741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-12 09:26:16 +00:00
gziolo 44a0e46c85 Editor: Update `build_comment_query_vars_from_block` from Gutenberg
Follow-up for [53138].
See #55505.


Built from https://develop.svn.wordpress.org/trunk@53142


git-svn-id: http://core.svn.wordpress.org/trunk@52731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 16:35:10 +00:00
gziolo f3fc52f959 Editor: Add changes for new Comments Query Loop blocks
Backports changes from Gutenberg to add functions required by Comment Query Loop and related blocks. Related unit tests depends on the new blocks and they will get added seperately.

Props darerodz, timothyblynjacobs.
See #55505.


Built from https://develop.svn.wordpress.org/trunk@53138


git-svn-id: http://core.svn.wordpress.org/trunk@52727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 15:22:09 +00:00
gziolo 0ae89f5171 Editor: Allow registration of blocks that include assets from within a theme
Fixes the issue when you register blocks with `block.json` in your theme. There is no longer an assets's URL error because it resolves correctly in relation to the theme where it is located.

Props fabiankaegy, ocean90, whoisnegrello, audrasjb, peterwilsoncc, 
Fixes #54647, #55513.


Built from https://develop.svn.wordpress.org/trunk@53091


git-svn-id: http://core.svn.wordpress.org/trunk@52680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-07 11:59:05 +00:00
gziolo 54bdc31c99 Editor: Fix broken asset URLs when using WP outside of the regular directory
Both CSS and JS URLs were totally broken for some of the newer blocks (e.g. the navigation block in the 2022 theme) when WP core is outside of the current directory using a different prefix.

Props pgpagely, Mamaduka.
Fixes #55311.



Built from https://develop.svn.wordpress.org/trunk@52939


git-svn-id: http://core.svn.wordpress.org/trunk@52528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-16 10:22:03 +00:00
audrasjb 401e5d7175 Docs: Correct return type for `get_block_metadata_i18n_schema()`.
Props jeremyfelt.
Fixes #55243.
See #54729.

Built from https://develop.svn.wordpress.org/trunk@52793


git-svn-id: http://core.svn.wordpress.org/trunk@52382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-24 08:27:09 +00:00
jorgefilipecosta cb3e78b0c3 Script Loader: Improvements to the load block support styles mechanism.
This commit applies feedback given to commit 52741. It changes the new function name, the file where it is located, and improves its documentation and marks.

Follow-up to [52741].
Props hellofromtonya, swissspidy, oandregal.
See #55148.
Built from https://develop.svn.wordpress.org/trunk@52743


git-svn-id: http://core.svn.wordpress.org/trunk@52332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-16 22:20:01 +00:00
jorgefilipecosta a73446f6ed Script Loader: Load block support styles in the head for block themes.
The dynamic block styles for layout and elements should be loaded in the head for block themes. While that should also be the case for classic themes, the current mechanism we use (render_block) does not allow us to do that, hence, this PR doesn't change anything for them and will be loaded the body.

Props oandregal, youknowriad, wpsoul.
Fixes #55148.
Built from https://develop.svn.wordpress.org/trunk@52741


git-svn-id: http://core.svn.wordpress.org/trunk@52330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-16 17:28:01 +00:00
gziolo a877a9806b I18n: Standardize the script paths for blocks
When providing file paths to scripts (editorScript, script or viewScript), when there is a trailing ./ included then there was a different md5 generated for the file that didn't match the one used with the file generated in the translations folder.

Props Rahe.
See #54797.


Built from https://develop.svn.wordpress.org/trunk@52699


git-svn-id: http://core.svn.wordpress.org/trunk@52288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 12:14:04 +00:00
Sergey Biryukov ef5a994a3c Docs: Fix typos in some DocBlocks.
Props kebbet.
See #54729.
Built from https://develop.svn.wordpress.org/trunk@52597


git-svn-id: http://core.svn.wordpress.org/trunk@52185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-18 20:29:06 +00:00
davidbaumwald f950eec323 Script Loader: Fix a variable typo in `wp_enqueue_block_style`.
In `wp_enqueue_block_style` when `rtl` versions of CSS files are detected, `wp_style_add_data` is called to add the metadata to the registered sheet.  However, the stylesheet `handle` argument is misspelled as `hanle`.  This change corrects the argument name.

Props omaeyusuke.
Fixes #54786.
Built from https://develop.svn.wordpress.org/trunk@52558


git-svn-id: http://core.svn.wordpress.org/trunk@52148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-11 17:16:00 +00:00
hellofromTonya 2a686addf0 Editor: Fix enqueueing additional styles in `wp_enqueue_block_style()` to print only when blocks render.
In a block theme, additional block styles registered using the `wp_enqueue_block_style` function should only get printed when the block exists on a page. However, they currently always get rendered.

This commit is a backport from Gutenberg that fixes the issue by printing the styles when a block renders.

Follow-up to [52069].

Props poena, aristath, Mamaduka.
Fixes #54787.
Built from https://develop.svn.wordpress.org/trunk@52556


git-svn-id: http://core.svn.wordpress.org/trunk@52146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-11 16:00:01 +00:00
audrasjb adee0cbf6b Docs: Docblock adjustments in some 5.9 block related functions.
Adds missing `@since` mention to `wp_enqueue_block_style()` and `_wp_multiple_block_styles()`, and a few other minor changes. 

Follow-up to [52069].

See #53359.

Built from https://develop.svn.wordpress.org/trunk@52354


git-svn-id: http://core.svn.wordpress.org/trunk@51946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-11 11:16:03 +00:00
audrasjb 12369a6425 Coding Standards: Correct alignment in `blocks.php` and `class-wp-rest-templates-controller`.
See #53359.

Built from https://develop.svn.wordpress.org/trunk@52345


git-svn-id: http://core.svn.wordpress.org/trunk@51937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 22:49:59 +00:00
audrasjb 25b3d172b7 Editor: Avoid a JS console error on the Navigation block view.
Props mkaz, sabernhardt, costdev.
Fixes #54456.

Built from https://develop.svn.wordpress.org/trunk@52291


git-svn-id: http://core.svn.wordpress.org/trunk@51883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 20:02:01 +00:00
noisysocks c421e9b34a Add Site Editor and PHP changes from Gutenberg 10.1 - 11.9
- First pass at adding the site editor from the Gutenberg plugin to
  wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.

Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.

Built from https://develop.svn.wordpress.org/trunk@52069


git-svn-id: http://core.svn.wordpress.org/trunk@51661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 02:17:17 +00:00
noisysocks f05f235042 Editor: Add block theme infrastructure
Adds the required infrastructure to render block-based themes. This is sourced
from the Gutenberg plugin.

Fixes #54335.
Props bernhard-reiter, youknowriad, ntsekouras, hellofromtonya.

Built from https://develop.svn.wordpress.org/trunk@52062


git-svn-id: http://core.svn.wordpress.org/trunk@51654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 23:10:59 +00:00
jorgefilipecosta 8e7b8a1837 Add: get_query_pagination_arrow function to core.
Fixes a crash that is happening when using an FSE theme because a function required is missing. Ports the function from the Gutenberg plugin.

Props oandregal, youknowriad.
Built from https://develop.svn.wordpress.org/trunk@52057


git-svn-id: http://core.svn.wordpress.org/trunk@51649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 22:31:58 +00:00
gziolo e4da863a6f Docs: Clarify the path usage register_block_type_from_metadata
The filename passed with the first param must end with `block.json`.

Fixes #53806.
Props coreyw, costdev.


Built from https://develop.svn.wordpress.org/trunk@52012


git-svn-id: http://core.svn.wordpress.org/trunk@51603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-04 16:03:57 +00:00
Sergey Biryukov f57070bfd1 Docs: Add a `@since` note for the new `$parent_block` parameter of several filters:
* `pre_render_block`
* `render_block_data`
* `render_block_context`

Follow-up to [51894].

See #51612.
Built from https://develop.svn.wordpress.org/trunk@51895


git-svn-id: http://core.svn.wordpress.org/trunk@51488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-07 13:15:59 +00:00
Andrew Ozz 2dc8f381ca Apply the `pre_render_block`, `render_block_data`, and `render_block_context` filters when rendering inner/nested blocks. Introdices another param to these filters: `$parent_block` that is the "parent" WP_Block instance for nested blocks and null for top level blocks. Adds unit tests for the filters.
Props noisysocks, gaambo, azaozz.
Fixes #51612.
Built from https://develop.svn.wordpress.org/trunk@51894


git-svn-id: http://core.svn.wordpress.org/trunk@51487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-06 18:49:01 +00:00
hellofromTonya a64837dfde Coding Standards: Use strict type check for `in_array()` in `register_block_script_handle()`.
Follow-up to [51501].

Props aristath, sergeybiryukov.
Fixes #54206. See #53359.
Built from https://develop.svn.wordpress.org/trunk@51888


git-svn-id: http://core.svn.wordpress.org/trunk@51481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-05 16:53:00 +00:00
desrosj 9bc8352b00 Editor: Ensure block attribute serialization in PHP matches the JavaScript equivalent.
The `serializeAttributes()` function in JavaScript uses `JSON.stringify`, which does not encode slashes and unicode characters by default. This resulted in the PHP serialization through `json_encode()` producing different results.

This also switches from `json_encode()` to `wp_json_encode()` to prevent failures when any non UTF-8 characters are included.

Props kevinfodness, SergeyBiryukov, timothyblynjacobs.
Fixes #53936.
Built from https://develop.svn.wordpress.org/trunk@51674


git-svn-id: http://core.svn.wordpress.org/trunk@51280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 19:10:58 +00:00
gziolo 2f6eb9d25e Blocks: Add support for `variations in `block.json` file
We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the `block.json` metadata file when using `register_block_type`.

Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as `translate_settings_using_i18n_schema`.

Props: gwwar, swissspidy, schlessera, jorgefilipecosta.
Fixes #53238.


Built from https://develop.svn.wordpress.org/trunk@51599


git-svn-id: http://core.svn.wordpress.org/trunk@51210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 09:08:01 +00:00
gziolo 327852393a Build: Split packages and blocks to their webpack configs
It aligns with the changes proposed added in Gutenberg: https://github.com/WordPress/gutenberg/pull/33293.

The idea here is to split the growing webpack config into two parts: blocks and  packages.

We need to add handling for JavaScript files that are going to be used with blocks on the frontend. They didn't work quite well with the current setup for entry points created for packages.

As part of the effort, it adds support for `viewScript` in `block.json` metadata file that is later translated to `$view_script` in `WP_Block_Type` class and exposed as `view_script` from the REST API endpoint for block types.

Props youknowriad, desrosj, aristath.
Fixes #53690.


Built from https://develop.svn.wordpress.org/trunk@51501


git-svn-id: http://core.svn.wordpress.org/trunk@51112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-28 10:06:59 +00:00
John Blackbourn 0434d4d30b Docs: Miscellaneous docblock corrections and improvements.
See #53399

Built from https://develop.svn.wordpress.org/trunk@51477


git-svn-id: http://core.svn.wordpress.org/trunk@51088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 16:54:58 +00:00
Aaron Jorbin 381a720ea9 Fix merge info.
[51378] contained merge info it shouldn't and accidentally a line of code from one of those commits that another one had changed.

See #53604.
Unprops jorbin.


Built from https://develop.svn.wordpress.org/trunk@51379


git-svn-id: http://core.svn.wordpress.org/trunk@50990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 22:47:56 +00:00
Aaron Jorbin f4acd73b70 Posts: Fix Spelling in inline docs.
A warpper is the traditional home of a neditor. They generally are optimized for supporting the good quality content that a neditor requires to survive. Some warppers feel like they have been around forever but have laid a foundation for newer warppers. A specific Russian warppers is known for having a wide footprint and touching almost everything. Warppers were originally only found subversioned underground, but they have been able to GIT above ground in the last few years.

The number of warpers in the world is small, but without them the neditor would never survive.

See [23105], [51375], #53604.
Props SergeyBiryukov.


Built from https://develop.svn.wordpress.org/trunk@51378


git-svn-id: http://core.svn.wordpress.org/trunk@50989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 22:39:57 +00:00
desrosj 501e37bf2b Posts: Allow the list of wrapper blocks to be filtered.
This introduces the `excerpt_allowed_wrapper_blocks` filter for controlling which blocks should be considered wrapper blocks.

Wrapper blocks and their nested contents are not stripped by `excerpt_remove_blocks()`, allowing their contents to appear in generated excerpts.

Follow up to [51348].

Props aristath, jorbin.
See #53604.
Built from https://develop.svn.wordpress.org/trunk@51375


git-svn-id: http://core.svn.wordpress.org/trunk@50986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-07 19:10:57 +00:00
Peter Wilson d73dcb8378 Block Editor: Update packages with latest fixes for 5.8 RC2
Includes the following fixes:

- Query Block: Type validation of `WP_Query` parameters.

Props ntsekouras, stevehenty, peterwilsoncc, desrosj.
Fixes #53397.


Built from https://develop.svn.wordpress.org/trunk@51362


git-svn-id: http://core.svn.wordpress.org/trunk@50971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 23:57:21 +00:00
desrosj 98579e4495 Posts: Prevent an empty excerpt when groups and nested column blocks are present.
This improves the logic within `excerpt_remove_blocks()` to better handle `innerBlocks`. This prevents an empty excerpt from being returned when `core/columns`, `core/column`, and `core/group` blocks are present.

This issue has been surfaced in the Query Loop block, where excerpts can be set to display. 

Props aristath.
Fixes #53604.
Built from https://develop.svn.wordpress.org/trunk@51348


git-svn-id: http://core.svn.wordpress.org/trunk@50957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 15:32:57 +00:00
John Blackbourn 79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

Built from https://develop.svn.wordpress.org/trunk@51298


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
desrosj 9e3049477c Script Loader: Revert [51267].
This was missed in [51268] when reverting [51259-51260,51265].

Props pbiron.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51288


git-svn-id: http://core.svn.wordpress.org/trunk@50897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 18:26:03 +00:00
Sergey Biryukov a58c86abd8 Docs: Improve documentation for optional parameters in `WP_Theme_JSON_Resolver` methods per the documentation standards.
Move `add_action()` call to `wp-includes/default-filters.php`.

Follow-up to [50959], [51221].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51284


git-svn-id: http://core.svn.wordpress.org/trunk@50893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 17:20:58 +00:00
desrosj 8c3e1e9aa8 Build/Test Tools: Revert [51259-51256,51265].
[51259] introduced a PHP notice that was not actually fixed by [51265]. Reverting these changes in order to investigate further.

See #53397.
Built from https://develop.svn.wordpress.org/trunk@51268


git-svn-id: http://core.svn.wordpress.org/trunk@50877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 02:14:56 +00:00
desrosj e7387a9ace Script Loader: Fix PHP notice caused by the `viewScript` for the `core/file` block.
This fixes a PHP notice caused by the `viewScript` for the `core/file` block having `.min.js` instead of just `.js`.

`register_block_script_handle()` was incorrectly looking for `view.min.asset.php`, which does not exist, and caused the `_doing_it_wrong()` notice.

This adds a check for `.min.js` in the `viewScript` field of `block.json` and corrects it to `.js` in order to match the expected pattern of `view.asset.php` until a more permanent fix can be created.

Follow up to [51259].

Props ipstenu, pbiron, peterwilsoncc.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51267


git-svn-id: http://core.svn.wordpress.org/trunk@50876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 01:46:57 +00:00
desrosj 6fc65b33d5 Script Loader: Use the provided block version when registering styles.
This updates `register_block_style_handle()` to use the `version` value provided in the `$metadata` parameter for non-Core blocks (when present). This removes the requirement to use `filemtime()` to generate a unique version.

When `version` is not defined within `$metadata`, the script version will fallback to using the current version of WordPress.

The block version should be considered similar to the one specified by plugin developers within the header of the main plugin file.

Props hellofromTonya, gziolo, jorbin, desrosj, walbo, aristath.
Fixes #53507.
Built from https://develop.svn.wordpress.org/trunk@51262


git-svn-id: http://core.svn.wordpress.org/trunk@50871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 18:24:56 +00:00
youknowriad 8e08c569c5 Build: Split packages and blocks to their webpack configs.
This also adds support for the viewScript for blocks fixing 
the PDF preview for file blocks.

Props desrosj, gziolo.
See #53397.

Built from https://develop.svn.wordpress.org/trunk@51259


git-svn-id: http://core.svn.wordpress.org/trunk@50868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 15:09:58 +00:00
desrosj 186d7c75ea Coding Standards: Apply an alignment fix after `composer format`.
Follow up to [51254].

See #53375.
Built from https://develop.svn.wordpress.org/trunk@51255


git-svn-id: http://core.svn.wordpress.org/trunk@50864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 00:39:58 +00:00
desrosj 516bc482bd Editor: Prevent block stylesheets from loading when they do not exist.
This fixes an issue where block stylesheets were being loaded even if they did not exist, causing 404 errors. The issue presented itself when the site was choosing to load block assets individually through the `should_load_separate_core_block_assets` filter hook.

This also fixes an issue where non-Core blocks would only be registered if they actually had asset files. This prevents developers from adding additional information to a style handle, such as inline styles through `wp_add_inline_style()`.

Props walbo, jorbin, aristath, desrosj, hellofromTonya.
Fixes #53375.
Built from https://develop.svn.wordpress.org/trunk@51254


git-svn-id: http://core.svn.wordpress.org/trunk@50863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-29 00:08:57 +00:00
desrosj fccc020d29 Docs: Various docblock corrections for code added in 5.8.
Props johnbillion.
See #53461.
Built from https://develop.svn.wordpress.org/trunk@51221


git-svn-id: http://core.svn.wordpress.org/trunk@50830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-23 19:05:57 +00:00