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
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
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
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
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
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
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
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
- 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
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
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
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
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
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
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
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
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
This replaces a stray instance of `gutenberg_experimental_set()` with the WordPress Core version of this function, `_wp_array_set()`.
A stray `gutenberg` text domain is also removed from a `__()` call.
Props walbo, chaion07, JeffPaul.
Fixes#53369.
Built from https://develop.svn.wordpress.org/trunk@51148
git-svn-id: http://core.svn.wordpress.org/trunk@50757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since the function only checks the raw, non-parsed post content, reusable blocks are just a `core/block` type and nothing more at that point.
In order to also check reusable blocks, the content needs to be parsed using `parse_blocks()` first.
Props vyskoczilova, peterwilsoncc.
Fixes#53140.
Built from https://develop.svn.wordpress.org/trunk@51046
git-svn-id: http://core.svn.wordpress.org/trunk@50655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This also includes:
- The removal of the Post Author block.
- Renaming build_query_vars_from_query_block function.
- Update the block supports.
Props gziolo.
See #52991.
-This line, and those below, will be ignored--
M package-lock.json
M package.json
M src/wp-includes/assets/script-loader-packages.php
M src/wp-includes/block-supports/colors.php
AM src/wp-includes/block-supports/elements.php
D src/wp-includes/block-supports/padding.php
AM src/wp-includes/block-supports/spacing.php
M src/wp-includes/block-supports/typography.php
M src/wp-includes/blocks/column/block.json
M src/wp-includes/blocks/index.php
D src/wp-includes/blocks/post-author
D src/wp-includes/blocks/post-author.php
M src/wp-includes/blocks/post-content.php
M src/wp-includes/blocks/post-featured-image.php
M src/wp-includes/blocks/query/block.json
M src/wp-includes/blocks/query-loop/block.json
M src/wp-includes/blocks/query-loop.php
M src/wp-includes/blocks/query-pagination/block.json
M src/wp-includes/blocks/query-pagination-next.php
M src/wp-includes/blocks/query-pagination-numbers.php
M src/wp-includes/blocks/site-tagline/block.json
M src/wp-includes/blocks/site-title/block.json
M src/wp-includes/blocks.php
M src/wp-settings.php
M tests/phpunit/tests/blocks/block.php
M tools/webpack/packages.js
Built from https://develop.svn.wordpress.org/trunk@50945
git-svn-id: http://core.svn.wordpress.org/trunk@50554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
It contains several changes in addition to regular update to WordPress packages:
- All newly exposed blocks are now registered on the server.
- Dutone block support was added.
- Border block support was updated.
- New shared function `construct_wp_query_args` was added for the family of Query blocks - it might need some further work.
Props youknowriad.
See #52991.
Built from https://develop.svn.wordpress.org/trunk@50929
git-svn-id: http://core.svn.wordpress.org/trunk@50538 1a063a9b-81f0-0310-95a4-ce76da25c4cd