[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwentyone/assets/js/ -> editor.js (source)

   1  /* global setTimeout */
   2  wp.domReady( function() {
   3      // Unregister "Wide" Separator Style.
   4      wp.blocks.unregisterBlockStyle( 'core/separator', 'wide' );
   5  
   6      // Add to ".block-editor__typewriter" the "is-dark-theme" class if needed.
   7  	function twentytwentyoneCopyDarkThemeClass() {
   8          var editor,
   9              attemptDelay = 25,
  10              attempt = 0,
  11              maxAttempts = 10;
  12  
  13          if ( ! document.body.classList.contains( 'is-dark-theme' ) ) {
  14              return;
  15          }
  16  
  17          editor = document.querySelector( '.block-editor__typewriter' );
  18          if ( null === editor ) {
  19              // Try again.
  20              if ( attempt < maxAttempts ) {
  21                  setTimeout( function() {
  22                      twentytwentyoneCopyDarkThemeClass();
  23                  }, attemptDelay );
  24  
  25                  // Increment the attempts counter.
  26                  attempt++;
  27  
  28                  // Double the delay, give the server some time to breathe.
  29                  attemptDelay *= 2;
  30              }
  31              return;
  32          }
  33  
  34          editor.classList.add( 'is-dark-theme' );
  35      }
  36  
  37      twentytwentyoneCopyDarkThemeClass();
  38  } );


Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1