Integrates the directives processing into the WP_Block class. It removes the overhead of running additional hooks when rendering blocks and simplifies the way we detect whether the directive processing should run on an interactive region of the produced final HTML for the blocks.
Introduces `interactivity_process_directives` filter to offer a way to opt out from directives processing. It's needed in Gutenberg: https://github.com/WordPress/gutenberg/pull/62095.
Props gziolo, cbravobernal.
Fixes#61185.
Built from https://develop.svn.wordpress.org/trunk@58234
git-svn-id: http://core.svn.wordpress.org/trunk@57697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The Tag Processor stores the byte-offsets into its HTML document where
the current token starts and ends, and also for every bookmark. In some
cases for tags, the end offset has been off by one.
In this patch the offset is fixed so that a bookmark always properly
refers to the full span of the token it's bookmarking. Also the current
token byte offsets are properly recorded.
While this is a defect in the Tag Processor, it hasn't been exposed
through the public interface and has not affected any of the working
of the processor. Only subclasses which rely on the length of a bookmark
have been potentially affected, and these are not supported environments
in the ongoing work.
This fix is important for future work and for ensuring that subclasses
performing custom behaviors remain as reliable as the public interface.
Developed in https://github.com/WordPress/wordpress-develop/pull/6625
Discussed in https://core.trac.wordpress.org/ticket/61301
Props dmsnell, gziolo, jonsurrell, westonruter.
Fixes#61301.
Built from https://develop.svn.wordpress.org/trunk@58233
git-svn-id: http://core.svn.wordpress.org/trunk@57696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In order to render the block template in the locked template preview inside the post editor we need to be able to fetch the contents of any block templates/template parts for any user role that can edit a post.
Props fabiankaegy, youknowriad.
Fixes#61137.
Built from https://develop.svn.wordpress.org/trunk@58227
git-svn-id: http://core.svn.wordpress.org/trunk@57690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Updated the global styles endpoints in the REST API to extend from existing posts and revisions controllers. This reduces duplicated code and inconsistencies. The revisions controller is now a subclass of the `WP_REST_Revisions_Controller`. Related redundant methods were removed and schema generation and collection parameters were adjusted to suit the global styles context. Updated permission checks, constructor, and collection parameters accordingly. This change allows for easy override of these classes using the `register_post_type_args` filter.
This reintroduces [57624] (reverted in [57628]) with improved backward compatibility and further enhancements.
Props ramonopoly, spacedmonkey, mukesh27, swissspidy.
Fixes#60131.
Built from https://develop.svn.wordpress.org/trunk@58225
git-svn-id: http://core.svn.wordpress.org/trunk@57688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the priority of the search form & remove `float` so that the visual position of the form matches it's positioning in the DOM.
This sets the priority of the search form to an arbitrarily high value of `9999` to ensure it will generally be last in the DOM.
Props joedolson, sabernhardt, audrasjb.
Fixes#60685.
Built from https://develop.svn.wordpress.org/trunk@58215
git-svn-id: http://core.svn.wordpress.org/trunk@57678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The logo block does not use theme mods, and instead saves a site-wide option `site_logo` to use as the site logo.
Add handling for cases where the logo image does not exist and delete the `site_logo` option when the attachment configured as site logo is deleted.
Props afercia, joedolson, khokansardar, SergeyBiryukov.
Fixes#60922.
Built from https://develop.svn.wordpress.org/trunk@58213
git-svn-id: http://core.svn.wordpress.org/trunk@57676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The caption for image block was misaligned. The issue appeared in 5.8 due to the block class name change making the selector meaningless. This is resolved by a change in the selectors.
Props nkeller15, sabernhardt, thakordarshil, anilvaza, shailu25, pavanpatil1, darshitrajyaguru97.
Fixes#58539.
Built from https://develop.svn.wordpress.org/trunk@58207
git-svn-id: http://core.svn.wordpress.org/trunk@57670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When a layout doesn't use custom post types it was appearing broken. This adds a filter for the display of the featured image to resolve this.
Props justnorris, JPry, davidakennedy, SergeyBiryukov, zkarj, poena, nhrrob, lamarajan.
Fixes#39281.
Built from https://develop.svn.wordpress.org/trunk@58206
git-svn-id: http://core.svn.wordpress.org/trunk@57669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The latest comments author font weight was showing different between editor and front. This fixes that and also removes an extra ruleset.
Props pitamdey, sabernhardt, shailu25, naeemhaque, darshitrajyaguru97.
Fixes#61180.
Built from https://develop.svn.wordpress.org/trunk@58204
git-svn-id: http://core.svn.wordpress.org/trunk@57667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The search box alignment was not in alignment. This brings in a resolution for that through the margin.
Props vinita29, SergeyBiryukov, poena, shailu25, makdiahussain, imranhasanraaz, darshitrajyaguru97, lamarajan.
Fixes#52551.
Built from https://develop.svn.wordpress.org/trunk@58202
git-svn-id: http://core.svn.wordpress.org/trunk@57665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Not all post types support autosaving. By making autosave a post type feature, support can be more granularly handled without any workarounds or hardcoded allowlists. `wp_font_family` and `wp_font_face` are examples of built-in post types which do not support autosave.
For backward compatibility reasons, adding `editor` support implies `autosave` support, so one would need to explicitly use `remove_post_type_support()` to remove it again.
Props swissspidy, youknowriad, hellofromtonya, peterwilsoncc.
Fixes#41172.
Built from https://develop.svn.wordpress.org/trunk@58201
git-svn-id: http://core.svn.wordpress.org/trunk@57664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The font on buttons was displaying less than the font size when applied through the editor. This resets the relative measurement on wp-block-button__link when either its Buttons or Button block has a custom size.
Props nidhidhandhukiya, sabernhardt, SergeyBiryukov, manojmaharrshi, darshitrajyaguru97, shailu25.
Fixes#56443.
Built from https://develop.svn.wordpress.org/trunk@58199
git-svn-id: http://core.svn.wordpress.org/trunk@57662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The h1 for entry-title was not the same between the editor and front end. This fixes that in the by setting wp-block-post-title font sizes together with h2 and combines post-section-dash mixin for both h1 and h2.
Props sabernhardt, nkeller15, shailu25.
Fixes#58440.
Built from https://develop.svn.wordpress.org/trunk@58198
git-svn-id: http://core.svn.wordpress.org/trunk@57661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This patch adds a new method, `WP_HTML_Processor->expects_closer()` to indicate
if the currently-matched node expects to find a closing token. For example, a
`DIV` element expects a closing `</div>` tag, but an `<img>` expects none, because
it's a void element. Similarly, `#text` nodes and HTML comments only appear as
unitary nodes on the stack of open elements. Once proceeding further in the
document they are immediately removed without any closing tag.
This new method serves as a helper to indicate whether or not to expect the
closer, as this can be more complicated than it seems, and calling code
shouldn't have to build custom interpretations and implementations. Instead,
the HTML Processor ought to export its internal knowledge to make it easy for
consuming code and projects.
Developed in https://github.com/WordPress/wordpress-develop/pull/6600
Discussed in https://core.trac.wordpress.org/ticket/61257Fixes#61257.
Props dmsnell, jonsurrell.
Built from https://develop.svn.wordpress.org/trunk@58192
git-svn-id: http://core.svn.wordpress.org/trunk@57655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The HTML Processor maintains a stack of open elements, where every element,
every `#text` node, every HTML comment, and other node is pushed and popped while
traversing the document. The "depth" of each of these nodes represents how deep
that stack is where the node appears. Unfortunately this information isn't
exposed to calling code, which has led different projects to attempt to
calculate this value externally. This isn't always trivial, but the HTML
Processor could make it so by exposing the internal knowledge in a new method.
In this patch the `get_current_depth()` method returns just that. Since the
processor always exists within a context, the depth includes nesting from the
always-present html element and also the body, since currently the HTML
Processor only supports parsing in the IN BODY context.
This means that the depth reported for the `DIV` in `<div>` is 3, not 1, because
its breadcrumbs path is `HTML > BODY > DIV`.
Developed in https://github.com/WordPress/wordpress-develop/pull/6589
Discussed in https://core.trac.wordpress.org/ticket/61255Fixes#61255.
Props dmsnell, jonsurrell.
Built from https://develop.svn.wordpress.org/trunk@58191
git-svn-id: http://core.svn.wordpress.org/trunk@57654 1a063a9b-81f0-0310-95a4-ce76da25c4cd