Skip to content

Commit

Permalink
Use divs as delimiters, comments not working for interactive innner c…
Browse files Browse the repository at this point in the history
…omponents
  • Loading branch information
cbravobernal committed Nov 28, 2023
1 parent 4116193 commit 585e8fd
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions lib/experimental/interactivity-api/directive-processing.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ function gutenberg_mark_block_interactivity( $block_content, $block, $block_inst
$block_instance->block_type->supports['interactivity']
) {
// Mark interactive blocks so we can process them later.
return get_comment_delimited_block_content(
'core/interactivity-wrapper',
array(
'blockName' => $block['blockName'],
// We can put extra information about the block here.
),
/**
* Debugging purposes only. Nested comments are not allowed.
* We wrap a hidden textarea to save the block content delimited
* by comments so we can later process it.
*/
return sprintf(
'<div data-wp-delimiter="interactivity-wrapper-start" style="display:none"></div>%s<div data-wp-delimiter="interactivity-wrapper-end" style="display:none"></div>',
$block_content
);
} elseif ( WP_Directive_Processor::is_marked_as_children_of_interactive_block( $block ) ) {
Expand All @@ -111,15 +112,7 @@ function gutenberg_mark_block_interactivity( $block_content, $block, $block_inst
* by comments so we can later process it.
*/
return sprintf(
'<textarea style="display:none"> %1s </textarea> %2s',
get_comment_delimited_block_content(
'core/non-interactivity-wrapper',
array(
'blockName' => $block['blockName'],
// We can put extra information about the block here.
),
$block_content
),
'<div data-wp-delimiter="non-interactivity-wrapper-start" style="display:none"></div>%s<div data-wp-delimiter="non-interactivity-wrapper-end" style="display:none"></div>',
$block_content
);
}
Expand Down

0 comments on commit 585e8fd

Please sign in to comment.