Changeset 7593
- Timestamp:
- 08/04/2018 05:54:11 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php
r7592 r7593 158 158 '_wpLoadGutenbergEditor.then( function() { wp.blocks.unregisterBlockType( "core/shortcode" ); } );' 159 159 ); 160 161 // Fix domReady for frontendberg 162 wp_add_inline_script( 163 'wp-dom-ready', 164 'wp.domReady = function( callback ) { 165 // The included domReady fails to call callbacks which are registered while readyState is "interactive". 166 // DOMContentLoaded fires at the start of interactive, but domReady only calls registered methods at "complete". 167 // This caused Frontendberg to white screen as the Gutenberg initialize call happens in that timespan when SessionStorage is empty 168 if ( 169 document.readyState === "complete" || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly. 170 document.readyState === "interactive" // DOMContentLoaded fires at this point, so we call directly. 171 ) { 172 return callback(); 173 } 174 175 // DOMContentLoaded has not fired yet, delay callback until then. 176 document.addEventListener("DOMContentLoaded", callback); 177 };' 178 ); 179 160 180 }, 11 ); 161 181 add_action( 'wp_enqueue_scripts', 'gutenberg_editor_scripts_and_styles' );
Note: See TracChangeset
for help on using the changeset viewer.