From cd180649ede152c8186268891df0e0465c3e73ee Mon Sep 17 00:00:00 2001 From: Mario Santos Date: Tue, 21 Mar 2023 10:51:25 +0100 Subject: [PATCH 1/3] Use `WP_Directive_Processor` class --- wp-directives.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-directives.php b/wp-directives.php index 38f39d84..0cf3d5f9 100644 --- a/wp-directives.php +++ b/wp-directives.php @@ -223,7 +223,7 @@ function process_directives_in_block( $block_content ) { 'data-wp-text' => 'process_wp_text', ); - $tags = new WP_HTML_Tag_Processor( $block_content ); + $tags = new WP_Directive_Processor( $block_content ); $tags = wp_process_directives( $tags, 'data-wp-', $directives ); return $tags->get_updated_html(); } From ac35c9cfa0600ab0dffb8b1bfbe1c0bb3b60938e Mon Sep 17 00:00:00 2001 From: Mario Santos Date: Tue, 21 Mar 2023 10:51:48 +0100 Subject: [PATCH 2/3] Change bookmarks end in `set_inner_html` --- src/directives/class-wp-directive-processor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/directives/class-wp-directive-processor.php b/src/directives/class-wp-directive-processor.php index d9a18cf0..4acc8669 100644 --- a/src/directives/class-wp-directive-processor.php +++ b/src/directives/class-wp-directive-processor.php @@ -85,7 +85,7 @@ public function set_inner_html( $new_html ) { list( $start_name, $end_name ) = $bookmarks; $start = $this->bookmarks[ $start_name ]->end + 1; - $end = $this->bookmarks[ $end_name ]->start; + $end = $this->bookmarks[ $end_name ]->start - 1; $this->seek( $start_name ); // Return to original position. $this->release_bookmark( $start_name ); From 7a9844fa66408f86d3ef394e5f2ab2ec41062f91 Mon Sep 17 00:00:00 2001 From: Mario Santos Date: Tue, 21 Mar 2023 12:07:22 +0100 Subject: [PATCH 3/3] Revert "Change bookmarks end in `set_inner_html`" This reverts commit ac35c9cfa0600ab0dffb8b1bfbe1c0bb3b60938e. --- src/directives/class-wp-directive-processor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/directives/class-wp-directive-processor.php b/src/directives/class-wp-directive-processor.php index 4acc8669..d9a18cf0 100644 --- a/src/directives/class-wp-directive-processor.php +++ b/src/directives/class-wp-directive-processor.php @@ -85,7 +85,7 @@ public function set_inner_html( $new_html ) { list( $start_name, $end_name ) = $bookmarks; $start = $this->bookmarks[ $start_name ]->end + 1; - $end = $this->bookmarks[ $end_name ]->start - 1; + $end = $this->bookmarks[ $end_name ]->start; $this->seek( $start_name ); // Return to original position. $this->release_bookmark( $start_name );