Skip to content

Commit 1b64c60

Browse files
committed
Register script modules unconditionally
1 parent 6152845 commit 1b64c60

File tree

2 files changed

+35
-33
lines changed

2 files changed

+35
-33
lines changed

html-api-debugger/html-api-debugger.php

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -70,44 +70,45 @@ function () {
7070
}
7171
);
7272

73+
wp_register_script_module(
74+
'@html-api-debugger/replace-invisible-chars',
75+
plugins_url( 'replace-invisible-chars.js', __FILE__ ),
76+
array(),
77+
VERSION
78+
);
79+
80+
wp_register_script_module(
81+
'@html-api-debugger/print-html-tree',
82+
plugins_url( 'print-html-tree.js', __FILE__ ),
83+
array(
84+
array(
85+
'id' => '@html-api-debugger/replace-invisible-chars',
86+
'import' => 'dynamic',
87+
),
88+
),
89+
VERSION
90+
);
91+
92+
wp_enqueue_script_module(
93+
'@html-api-debugger/main',
94+
plugins_url( 'view.js', __FILE__ ),
95+
array(
96+
'@wordpress/interactivity',
97+
'@html-api-debugger/print-html-tree',
98+
array(
99+
'id' => '@html-api-debugger/replace-invisible-chars',
100+
'import' => 'dynamic',
101+
),
102+
),
103+
VERSION
104+
);
105+
73106
add_action(
74107
'admin_enqueue_scripts',
75108
function ( $hook_suffix ) {
76109
if ( $hook_suffix === 'toplevel_page_' . SLUG ) {
77110
wp_enqueue_style( SLUG, plugins_url( 'style.css', __FILE__ ), array(), VERSION );
78-
79-
wp_register_script_module(
80-
'@html-api-debugger/replace-invisible-chars',
81-
plugins_url( 'replace-invisible-chars.js', __FILE__ ),
82-
array(),
83-
VERSION
84-
);
85-
86-
wp_register_script_module(
87-
'@html-api-debugger/print-html-tree',
88-
plugins_url( 'print-html-tree.js', __FILE__ ),
89-
array(
90-
array(
91-
'id' => '@html-api-debugger/replace-invisible-chars',
92-
'import' => 'dynamic',
93-
),
94-
),
95-
VERSION
96-
);
97-
98-
wp_enqueue_script_module(
99-
'@html-api-debugger/view',
100-
plugins_url( 'view.js', __FILE__ ),
101-
array(
102-
'@wordpress/interactivity',
103-
'@html-api-debugger/print-html-tree',
104-
array(
105-
'id' => '@html-api-debugger/replace-invisible-chars',
106-
'import' => 'dynamic',
107-
),
108-
),
109-
VERSION
110-
);
111+
wp_enqueue_script_module( '@html-api-debugger/view' );
111112
}
112113
}
113114
);

html-api-debugger/readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ Add a page to wp-admin for debugging the HTML API.
8484
= 1.7 =
8585
* Update DOM tree when HTML document is mutated.
8686
* Fix deprecation notice on WordPress 6.7.
87+
* Register script modules unconditionally.

0 commit comments

Comments
 (0)