Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/wp-includes/build/pages/font-library/page-wp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,20 @@ function wp_font_library_wp_admin_enqueue_scripts( $hook_suffix ) {
// 2. It initializes the boot module as an inline script.
wp_register_script( 'font-library-wp-admin-prerequisites', '', $asset['dependencies'], $asset['version'], true );

// Add inline script to initialize the app using initSinglePage (no menuItems)
/*
* Add inline script to initialize the app using initSinglePage (no menuItems).
* The dynamic import is deferred until DOMContentLoaded so that all classic
* script dependencies of @wordpress/boot (wp-private-apis, wp-components,
* wp-theme, etc.) have finished parsing and executing before the boot module
* evaluates. Otherwise, a modulepreloaded @wordpress/boot can win the race
* against the classic-script-printing pass on fast CDN-fronted hosts in
* Chrome, evaluating before wp.theme.privateApis is defined and throwing
* "Cannot unlock an undefined object". See #65103.
*/
wp_add_inline_script(
'font-library-wp-admin-prerequisites',
sprintf(
'import("@wordpress/boot").then(mod => mod.initSinglePage({mountId: "%s", routes: %s}));',
'(function(){var run=function(){import("@wordpress/boot").then(function(mod){mod.initSinglePage({mountId: "%s", routes: %s});});};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",run);}else{run();}})();',
'font-library-wp-admin-app',
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
)
Expand Down
13 changes: 11 additions & 2 deletions src/wp-includes/build/pages/font-library/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,21 @@ function wp_font_library_render_page() {
// 2. It initializes the boot module as an inline script.
wp_register_script( 'font-library-prerequisites', '', $asset['dependencies'], $asset['version'], true );

// Add inline script to initialize the app
/*
* Add inline script to initialize the app.
* The dynamic import is deferred until DOMContentLoaded so that all classic
* script dependencies of @wordpress/boot (wp-private-apis, wp-components,
* wp-theme, etc.) have finished parsing and executing before the boot module
* evaluates. Otherwise, a modulepreloaded @wordpress/boot can win the race
* against the classic-script-printing pass on fast CDN-fronted hosts in
* Chrome, evaluating before wp.theme.privateApis is defined and throwing
* "Cannot unlock an undefined object". See #65103.
*/
$init_modules = [];
wp_add_inline_script(
'font-library-prerequisites',
sprintf(
'import("@wordpress/boot").then(mod => mod.init({mountId: "%s", menuItems: %s, routes: %s, initModules: %s, dashboardLink: "%s"}));',
'(function(){var run=function(){import("@wordpress/boot").then(function(mod){mod.init({mountId: "%s", menuItems: %s, routes: %s, initModules: %s, dashboardLink: "%s"});});};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",run);}else{run();}})();',
'font-library-app',
wp_json_encode( $menu_items, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
Expand Down
13 changes: 11 additions & 2 deletions src/wp-includes/build/pages/options-connectors/page-wp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,20 @@ function wp_options_connectors_wp_admin_enqueue_scripts( $hook_suffix ) {
// 2. It initializes the boot module as an inline script.
wp_register_script( 'options-connectors-wp-admin-prerequisites', '', $asset['dependencies'], $asset['version'], true );

// Add inline script to initialize the app using initSinglePage (no menuItems)
/*
* Add inline script to initialize the app using initSinglePage (no menuItems).
* The dynamic import is deferred until DOMContentLoaded so that all classic
* script dependencies of @wordpress/boot (wp-private-apis, wp-components,
* wp-theme, etc.) have finished parsing and executing before the boot module
* evaluates. Otherwise, a modulepreloaded @wordpress/boot can win the race
* against the classic-script-printing pass on fast CDN-fronted hosts in
* Chrome, evaluating before wp.theme.privateApis is defined and throwing
* "Cannot unlock an undefined object". See #65103.
*/
wp_add_inline_script(
'options-connectors-wp-admin-prerequisites',
sprintf(
'import("@wordpress/boot").then(mod => mod.initSinglePage({mountId: "%s", routes: %s}));',
'(function(){var run=function(){import("@wordpress/boot").then(function(mod){mod.initSinglePage({mountId: "%s", routes: %s});});};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",run);}else{run();}})();',
'options-connectors-wp-admin-app',
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
)
Expand Down
13 changes: 11 additions & 2 deletions src/wp-includes/build/pages/options-connectors/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,21 @@ function wp_options_connectors_render_page() {
// 2. It initializes the boot module as an inline script.
wp_register_script( 'options-connectors-prerequisites', '', $asset['dependencies'], $asset['version'], true );

// Add inline script to initialize the app
/*
* Add inline script to initialize the app.
* The dynamic import is deferred until DOMContentLoaded so that all classic
* script dependencies of @wordpress/boot (wp-private-apis, wp-components,
* wp-theme, etc.) have finished parsing and executing before the boot module
* evaluates. Otherwise, a modulepreloaded @wordpress/boot can win the race
* against the classic-script-printing pass on fast CDN-fronted hosts in
* Chrome, evaluating before wp.theme.privateApis is defined and throwing
* "Cannot unlock an undefined object". See #65103.
*/
$init_modules = [];
wp_add_inline_script(
'options-connectors-prerequisites',
sprintf(
'import("@wordpress/boot").then(mod => mod.init({mountId: "%s", menuItems: %s, routes: %s, initModules: %s, dashboardLink: "%s"}));',
'(function(){var run=function(){import("@wordpress/boot").then(function(mod){mod.init({mountId: "%s", menuItems: %s, routes: %s, initModules: %s, dashboardLink: "%s"});});};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",run);}else{run();}})();',
'options-connectors-app',
wp_json_encode( $menu_items, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
Expand Down
Loading