CoreFiles by mySites.guru
editor.js38 lines, 921 bytes, from wordpress-5.7.21.zip
Raw History Compare with 5.7.20
md5
7e4ba061b8834f56c6de45c8fce81e15
sha1
57bc2096c1789303cc3847b1dacb556b7a970cd8
sha256
81ae95d2329723135b35465b1815fa1447429f8ea77371e5795c940188632207
/* global setTimeout */
wp.domReady( function() {
	// Unregister "Wide" Separator Style.
	wp.blocks.unregisterBlockStyle( 'core/separator', 'wide' );

	// Add to ".block-editor__typewriter" the "is-dark-theme" class if needed.
	function twentytwentyoneCopyDarkThemeClass() {
		var editor,
			attemptDelay = 25,
			attempt = 0,
			maxAttempts = 10;

		if ( ! document.body.classList.contains( 'is-dark-theme' ) ) {
			return;
		}

		editor = document.querySelector( '.block-editor__typewriter' );
		if ( null === editor ) {
			// Try again.
			if ( attempt < maxAttempts ) {
				setTimeout( function() {
					twentytwentyoneCopyDarkThemeClass();
				}, attemptDelay );

				// Increment the attempts counter.
				attempt++;

				// Double the delay, give the server some time to breathe.
				attemptDelay *= 2;
			}
			return;
		}

		editor.classList.add( 'is-dark-theme' );
	}

	twentytwentyoneCopyDarkThemeClass();
} );

The same content is in 246 releases, WordPress 5.6-beta4 to 6.4-RC4. See them all, or every version of this file.