How to use the @wordpress/block-editor.transformStyles function in @wordpress/block-editor

To help you get started, we’ve selected a few @wordpress/block-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / wordpress__block-editor / wordpress__block-editor-tests.tsx View on Github external
title: 'bar',
            onClick() {
                console.log('bar');
            },
        },
    ]}
>
    This is the warning message
;

//
// Utils
// ============================================================================

// $ExpectType string[]
be.transformStyles(STYLES);

// $ExpectType string[]
be.transformStyles(STYLES, '.foobar');

//
// Store
// ============================================================================

// $ExpectType void
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE);
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE, 4);
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE, 4, 'foo');
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE, 4, 'foo', false);

// $ExpectType IterableIterator
dispatch('core/block-editor').insertBlocks([BLOCK_INSTANCE]);
github DefinitelyTyped / DefinitelyTyped / types / wordpress__block-editor / wordpress__block-editor-tests.tsx View on Github external
},
        },
    ]}
>
    This is the warning message
;

//
// Utils
// ============================================================================

// $ExpectType string[]
be.transformStyles(STYLES);

// $ExpectType string[]
be.transformStyles(STYLES, '.foobar');

//
// Store
// ============================================================================

// $ExpectType void
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE);
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE, 4);
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE, 4, 'foo');
dispatch('core/block-editor').insertBlock(BLOCK_INSTANCE, 4, 'foo', false);

// $ExpectType IterableIterator
dispatch('core/block-editor').insertBlocks([BLOCK_INSTANCE]);
dispatch('core/block-editor').insertBlocks([BLOCK_INSTANCE], 5);
dispatch('core/block-editor').insertBlocks([BLOCK_INSTANCE], 5, 'foo');
dispatch('core/block-editor').insertBlocks([BLOCK_INSTANCE], 5, 'foo', false);
github WordPress / gutenberg / packages / block-library / src / html / edit.js View on Github external
const { styles } = this.props;

		// Default styles used to unset some of the styles
		// that might be inherited from the editor style.
		const defaultStyles = `
			html,body,:root {
				margin: 0 !important;
				padding: 0 !important;
				overflow: visible !important;
				min-height: auto !important;
			}
		`;

		this.setState( { styles: [
			defaultStyles,
			...transformStyles( styles ),
		] } );
	}
github WordPress / gutenberg / packages / editor / src / components / provider / index.js View on Github external
componentDidMount() {
		this.props.updateEditorSettings( this.props.settings );

		if ( ! this.props.settings.styles ) {
			return;
		}

		const updatedStyles = transformStyles( this.props.settings.styles, '.editor-styles-wrapper' );

		map( updatedStyles, ( updatedCSS ) => {
			if ( updatedCSS ) {
				const node = document.createElement( 'style' );
				node.innerHTML = updatedCSS;
				document.body.appendChild( node );
			}
		} );
	}