Skip to content

Commit a5c2853

Browse files
committed
PICKME: make the context html better
1 parent 37a0787 commit a5c2853

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

html-api-debugger/interactivity.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ function generate_page( string $html, array $options ): string {
6363
data-wp-init="run"
6464
class="html-api-debugger-container html-api-debugger--grid"
6565
>
66+
<div data-wp-bind--hidden="!state.htmlapiResponse.supports.create_fragment_advanced">
67+
<label>Context in which input HTML finds itself
68+
<textarea
69+
class="context-html"
70+
placeholder="Provide a fragment context, for example:&#x0A;<!DOCTYPE html><body>"
71+
title="Leave blank to parse a full document."
72+
rows="2"
73+
data-wp-on-async--input="handleContextHtmlInput"
74+
><?php echo "\n" . esc_textarea( str_replace( "\0", '', $options['context_html'] ?? '' ) ); ?></textarea>
75+
</label>
76+
</div>
6677
<div>
6778
<h2>Input HTML</h2>
6879
<textarea
@@ -139,16 +150,6 @@ class="html-api-debugger-container html-api-debugger--grid"
139150
<label>Show closers <input type="checkbox" data-wp-bind--checked="state.showClosers" data-wp-on-async--input="handleShowClosersClick"></label>
140151
<label>Show invisible <input type="checkbox" data-wp-bind--checked="state.showInvisible" data-wp-on-async--input="handleShowInvisibleClick"></label>
141152
<span><label>Show virtual <input type="checkbox" data-wp-bind--checked="state.showVirtual" data-wp-on-async--input="handleShowVirtualClick"></label></span>
142-
<div data-wp-bind--hidden="!state.htmlapiResponse.supports.create_fragment_advanced">
143-
<label>Context html
144-
<textarea
145-
class="context-html"
146-
placeholder="Provide a fragment context, for example:&#x0A;<!DOCTYPE html><body>"
147-
rows="2"
148-
data-wp-on-async--input="handleContextHtmlInput"
149-
><?php echo "\n" . esc_textarea( str_replace( "\0", '', $options['context_html'] ?? '' ) ); ?></textarea>
150-
</label>
151-
</div>
152153
<div>
153154
<label>CSS Selectors <input placeholder="CSS selector: .my-class" data-wp-on-async--input="handleSelectorChange"></label>
154155
<p data-wp-bind--hidden="!state.selectorErrorMessage" data-wp-text="state.selectorErrorMessage" class="error-holder"></p>

0 commit comments

Comments
 (0)