Skip to content

Commit

Permalink
Merge pull request #2 from Zamfi99/fix/support-rich-text-source
Browse files Browse the repository at this point in the history
[FIX] Support Rich-Text block source
  • Loading branch information
emilyatmobtown authored Apr 1, 2024
2 parents b59ef4d + 31b4140 commit 92e9640
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Blocks/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ protected static function source_attributes( $node, $type ) {
$source = $value['source'] ?? null;

switch ( $source ) {
case 'rich-text':
// Most 'html' sources were converted to 'rich-text' in WordPress 6.5.
// https://github.com/WordPress/gutenberg/pull/43204
$source_node = ! empty( $value['selector'] ) ? $node->findOne( $value['selector'] ) : $node;

if ( $source_node ) {
$result[ $key ] = $source_node->innerhtml;
}

break;
case 'html':
$source_node = ! empty( $value['selector'] ) ? $node->findOne( $value['selector'] ) : $node;

Expand Down

0 comments on commit 92e9640

Please sign in to comment.