Adds the `wp_set_script_translations` function which registers translations for a JavaScript file. This function takes a handle, domain and optionally a path and ensures JavaScript translation files are loaded if they exist.
Props atimmer, omarreiss, nerrad, swissspidy, ocean90.
Fixes#45103.
Built from https://develop.svn.wordpress.org/branches/5.0@43825
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Instead of requiring the packages individually this commit changes it so the packages are used from the packages repository (gutenberg). This is a solution that makes updating the packages easier, as long as we don't have a monorepo to manage both WordPress & the JavaScript packages together.
Props youknowriad, gziolo, omarreiss, herregroen.
See #45145.
Built from https://develop.svn.wordpress.org/branches/5.0@43824
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adapts the response from `WP_oEmbed_Controller::get_proxy_item()` so that the response is correctly filtered and embeds work properly in JavaSccript editors. Introduces new `get_oembed_response_data_for_url()` function for preparing internal oEmbed responses.
Props danielbachhuber, imath, swissspidy.
Fixes#45142.
Built from https://develop.svn.wordpress.org/branches/5.0@43810
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `@wordpress/editor` wasn't upgraded to the correct version in [43789].
This commit includes changes from the `@wordpress/block-library` upgrade in [43789], that weren't copied to the correct location in core.
This also regenerates the `package-lock.json` in Linux, which the build server requires.
See #45145.
Built from https://develop.svn.wordpress.org/branches/5.0@43801
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Seventeen.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
Props laurelfulford, ianbelanger, crunnells.
Fixes#45045.
Built from https://develop.svn.wordpress.org/branches/5.0@43800
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Sixteen.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
* Add theme support for `editor-color-palette`, to load a color palette based on the theme’s color scheme into the block-based editor.
Props laurelfulford.
Fixes#45044.
Built from https://develop.svn.wordpress.org/branches/5.0@43799
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Fifteen.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
* Add theme support for `editor-color-palette`, to load a color palette based on the theme’s color scheme into the block-based editor.
Props laurelfulford.
Fixes#45043.
Built from https://develop.svn.wordpress.org/branches/5.0@43798
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Fourteen.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
* Add theme support for `editor-color-palette`, to load a color palette based on the theme’s color scheme into the block-based editor.
Props laurelfulford, crunnells, ianbelanger.
Fixes#45042.
Built from https://develop.svn.wordpress.org/branches/5.0@43797
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Thirteen.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
* Add theme support for `editor-color-palette`, to load a color palette based on the theme’s color scheme into the block-based editor.
* Add theme support and styles for `align-wide`, to allow wide and full alignment styles on the blocks.
Props laurelfulford, ianbelanger.
Fixes#45041.
Built from https://develop.svn.wordpress.org/branches/5.0@43796
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Twelve.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
* Add theme support for `editor-color-palette`, to load a color palette based on the theme’s color scheme into the block-based editor.
Props ianbelanger, crunnells, laurelfulford.
Fixes#45040.
Built from https://develop.svn.wordpress.org/branches/5.0@43795
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Eleven.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
* Add theme support for `editor-color-palette`, to load a color palette based on the theme’s color scheme into the block-based editor.
Props ianbelanger, laurelfulford.
Fixes#45039.
Built from https://develop.svn.wordpress.org/branches/5.0@43794
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update adds styles and theme support related to the new block-based editor to enhance the experience of using it with Twenty Ten.
These are the specific changes made to this theme:
* Add blocks.css, to style blocks on the front end, to make sure they match the theme’s existing HTML element styles.
* Add editor-blocks.css to style blocks in the editor, to make sure they match the theme’s existing HTML element styles.
* Add theme support for `editor-styles`, to pull the existing editor stylesheet into the new editor.
* Add theme support for `wp-block-styles`, to load the default block styles on the front end.
* Add theme support for `editor-color-palette`, to load a color palette based on the theme’s color scheme into the block-based editor.
Props nielslange, crunnells, laurelfulford.
Fixes#45038.
Built from https://develop.svn.wordpress.org/branches/5.0@43793
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Responsive embeds is a way for a theme to opt in to WordPress dynamically scaling the width/height of an embed. When a theme supports responsive embeds, a `wp-embed-responsive` class is added to the `<body>` tag. This information is also presented through the REST API for clients to respect.
Props desrosj.
Fixes#45125.
Built from https://develop.svn.wordpress.org/branches/5.0@43790
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The cover image block uses the `url()` function in its inline CSS, to show the cover image. KSES didn't allow this, causing the block to not save correctly for Author and Contributor users. As KSES does already check each attribute name against an allowed list, we're able to add an extra check for certain attributes to be able to use the `url()` function, too.
Props peterwilsoncc, azaozz, pento, dd32.
See #45067.
Built from https://develop.svn.wordpress.org/branches/5.0@43781
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When meta boxes are registered, they can use the `__back_compat_meta_box` and `__block_editor_compatible_meta_box` flags, to show whether this registration just exists for if the classic editor is loaded, and whether this meta box is compatible with the block editor.
When a meta box marks itself as incompatible with the block editor, and `WP_DEBUG` is enabled, a warning will show inside that meta box in the classic editor.
As all core meta boxes have been recreated in the block editor, they can be marked with the `__back_compat_meta_box` flag.
See #45112.
Built from https://develop.svn.wordpress.org/branches/5.0@43779
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces new `determine_locale()` function for deciding the proper locale to use for a response. Default value is `get_user_locale()` in the admin, and `get_locale()` on the frontend. Because REST API requests are considered frontend requests, `?_locale=user` can be used to render the response in the user's locale.
Also updates `wp-login.php?wp_lang` implementation to benefit from this abstraction.
Props flixos90, mnelson4, swissspidy, TimothyBlynJacobs.
Fixes#44758.
Built from https://develop.svn.wordpress.org/branches/5.0@43776
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`WP_Text_Diff_Renderer_Table` is used to generate the diff view in revisions, but there were some cases that could cause it to take excessive amounts of time to run.
Some noteable cases include:
- When a large number of new lines were inserted in the middle of the post from one revision to the next.
- When both revisions contain >100 lines.
- When either revision contains a lot of long lines.
In one extreme test case, the diff view took over a minute to generate. With this change, it now takes less than a second.
See #35667.
Built from https://develop.svn.wordpress.org/branches/5.0@43775
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Narrow the scope of the included wp-admin files loaded for `wp_generate_attachment_metadata()`, `wp_handle_upload()`, `wp_tempnam()`, and `wp_handle_sideload()`. Requires only `wp-admin/includes/file.php` and `wp-admin/includes/image.php` instead of `wp-admin/includes/admin.php`.
Props ocean90, lonelyvegan, soulseekah, pratikthink.
Merges [43589], [43604] to the 5.0 branch.
Fixes#43757.
Built from https://develop.svn.wordpress.org/branches/5.0@43773
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Adds `WP_REST_Autosaves_Controller` which extends `WP_REST_Revisions_Controller`.
* Autosaves endpoint is registered for all post types except `attachment` because even post types without revisions enabled are expected to autosave.
* Because setting the `DOING_AUTOSAVE` constant pollutes the test suite, autosaves tests are run last. We may want to improve upon this later.
Props adamsilverstein, aduth, azaozz, danielbachhuber, rmccue.
Fixes#43316.
Built from https://develop.svn.wordpress.org/branches/5.0@43768
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`rest_url()` inconsistent addes slashes to the passed path depending on whether the site has pretty permalinks enabled. Apart from being inconsistent, this also caused the unit tests to fail when pretty permalinks are enabled.
Props frank-klein.
Merges [42250] to the 5.0 branch.
Partially reverts [43720].
Fixes#42452. See #41451, #45017.
Built from https://develop.svn.wordpress.org/branches/5.0@43766
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- `grunt webpack:dev` now copies packages JS into `/src/wp-includes/js/dist`, and CSS into `/src/wp-includes/css/dist`.
- `grunt webpack:prod` does the same, but into `/build` instead of `/src`.
- `grunt build` now runs the `webpack:prod` task.
Props atimmer, pento.
Fixes#45119.
Built from https://develop.svn.wordpress.org/branches/5.0@43760
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful.
Props shooper.
Merges [42354] to the 5.0 branch.
Fixes#42781. See #41370.
Built from https://develop.svn.wordpress.org/branches/5.0@43756
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The permissions error message when a request tries to fetch post statuses unauthenticated is incorrect. It was a copy/paste from elsewhere, as indicated by the use of "in this post type" where this is no post type referenced.
Props schlessera.
Merges [42356] to the 5.0 branch.
Fixes#42303.
Built from https://develop.svn.wordpress.org/branches/5.0@43755
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
After [43738], TinyMCE would be loaded earlier than before, which
makes filters run at a different time relative to the loading of
TinyMCE. Fix this by calling `wp_print_scripts` at the location where
TinyMCE would previously be inserted as a `<script>` tag in the page.
Props azaozz, omarreiss.
Fixes#45065.
Built from https://develop.svn.wordpress.org/branches/5.0@43753
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `WP_Block_Parser` class, and the accompanying `parse_blocks()` helper function, can be used to parse an array of blocks out of a content string.
`WP_Block_Parser` is copied from the `@wordpress/block-serialization-default-parser` package. To ensure it stays in sync with the JavaScript parser, changes should be implemented in the package first, then the package version should be upgraded to include the changes.
See #45109.
Built from https://develop.svn.wordpress.org/branches/5.0@43751
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These are the foundational classes allowing blocks to be registered and used throughout WordPress.
This commit also includes the `has_block()` and `has_blocks()` functions, which are required for unit testing these classes.
Props adamsilverstein, danielbachhuber, desrosj.
See #45097, #45109.
Built from https://develop.svn.wordpress.org/branches/5.0@43742
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces a `WP_REST_Search_Controller` class which registers a `/wp/v2/search` endpoint. Search types are handled by extending `WP_REST_Search_Handler`. The default search type is `WP_REST_Post_Search_Handler` but can be filtered by plugins or a theme.
Props danielbachhuber, flixos90, pento, rmccue.
Fixes#39965.
Built from https://develop.svn.wordpress.org/branches/5.0@43739
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adjusts the packages registration after [43723]:
* Combine the different registration functions into one
`wp_default_packages` function. To reach this goal move the prefix
logic into a function so it can be called from different locations.
Use a `static` variable there to prevent duplicate inclusion of
`version.php`.
* Call this function from the `wp_default_scripts` action by
registering it as a default filter.
* Combine some of the logic in `_WP_Editors::print_tinymce_scripts`
into `wp_register_tinymce_scripts`. The logic to force an uncompressed
TinyMCE script file stays in `_WP_Editors::force_uncompressed_tinymce`
because that logic is very specific to the classic editor.
* The script handle `wp-tinymce` is now a dependency of the `editor`
script handle. In combination with the previous item, this makes the
classic editor work.
* Adjust the syntax of the script paths to be more consistent with
other WordPress code.
* Always use `"production"` mode for the media files to prevent people
from inadvertently committing development files.
Props pento, omarreiss.
Fixes#45065.
Built from https://develop.svn.wordpress.org/branches/5.0@43738
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In order to correctly render parts of its UI, the new editor needs to be aware of the active theme's post-formats and post-thumbnails support. This data is exposed by querying for the active theme on a new /wp/v2/themes endpoint for sufficiently privileged users.
props desrosj.
Fixes#45016.
Built from https://develop.svn.wordpress.org/branches/5.0@43734
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Because WP REST API requests aren't identified until `parse_request`, it's impractical to reference the `REST_REQUEST` constant in `wp_debug_mode()`. Instead, it's more helpful to assume that a request wanting a JSON response probably doesn't want PHP errors breaking the response.
Props chrisl27, duanestorey, earnjam.
Fixes#44534.
Built from https://develop.svn.wordpress.org/branches/5.0@43730
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.
Props flixos90, spacedmonkey.
Fixes#44467.
Built from https://develop.svn.wordpress.org/branches/5.0@43729
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In the full edit screen, CPTs that have disabled the `publicly_queryable` option will hide the slug field, as it doesn't need to be edited. This change brings the Quick Edit view into line with that behaviour.
Merges [43664] to the 5.0 branch.
Props bhargavmehta, krutidugade.
Fixes#43278.
Built from https://develop.svn.wordpress.org/branches/5.0@43728
git-svn-id: http://core.svn.wordpress.org/branches/5.0@43557 1a063a9b-81f0-0310-95a4-ce76da25c4cd