You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if we hook into the block-level filter (the design of which I favor in #10108) then we can track the parse through the blocks and then prime the cache on the do_blocks filter which occurs after parsing and rendering is complete.
that is, we could imagine something like this…
function _gutenberg_cache_images_meta( $html, $block ) {
if ( $block['blockName'] === 'core/image' ) {
$this->add_image( $block['attrs']['id'] );
}
return $html;
}
add_filter( 'rendered_block', '_gutenberg_cache_images_meta', 3 );
function _gutenberg_prime_cache() {
if ( empty( $this->images ) ) {
return;
}
// whatever command does all images in one go
_prime_post_caches( $this->images, false, true, true, true, false, false );
}
add_filter( 'do_blocks', '_gutenberg_prime_cache' );
and this because we know that the final do_blocks filter runs after block-level processing.
As work is completing in #11973, I am creating this issue to kick off discussion around adding a filter to parse block content.
The text was updated successfully, but these errors were encountered:
In #11973 there was talk of needing a way to parse the results of a block instead of using regular expression.
@aduth mentioned: #11973 (comment)
@dmsnell mentioned #11973 (comment)
As work is completing in #11973, I am creating this issue to kick off discussion around adding a filter to parse block content.
The text was updated successfully, but these errors were encountered: