How to use the @wordpress/blocks.createBlock function in @wordpress/blocks

To help you get started, we’ve selected a few @wordpress/blocks 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 Automattic / jetpack / extensions / blocks / contact-form / index.js View on Github external
				transform: attributes => createBlock( 'jetpack/field-textarea', attributes ),
			},
github Automattic / wp-calypso / packages / jetpack-blocks / src / blocks / contact-form / index.js View on Github external
				transform: attributes => createBlock( 'jetpack/field-text', attributes ),
			},
github godaddy-wordpress / coblocks / src / blocks / gallery-collage / transforms.js View on Github external
transform: ( attributes ) => {
				const newAttributes = Object.assign(
					GalleryTransforms( attributes ),
					{ images: attributes.images.filter( image => typeof image.id !== 'undefined' ) }
				);
				return createBlock( 'coblocks/gallery-carousel', newAttributes );
			},
		},
github WordPress / gutenberg / packages / block-library / src / embed / core-embeds.js View on Github external
transform: ( content ) => {
					return createBlock( 'core-embed/speaker-deck', {
						content,
					} );
				},
			} ],
github dsifford / academic-bloggers-toolkit / src / js / stores / data / actions.ts View on Github external
function* setBibliography({ items, meta }: Processor.Bibliography) {
    const blocksList = select('core/block-editor').getBlocks();
    const bibliographyBlock = blocksList.find(
        block => block.name === 'abt/bibliography',
    );
    if (items.length > 0 && bibliographyBlock) {
        yield dispatch('core/block-editor').updateBlockAttributes(
            bibliographyBlock.clientId,
            { ...meta, items },
        );
    } else if (items.length > 0 && !bibliographyBlock) {
        yield dispatch('core/block-editor').insertBlock(
            createBlock('abt/bibliography', {
                ...meta,
                items,
            }),
            blocksList.length,
            undefined,
            false,
        );
    } else if (items.length === 0 && bibliographyBlock) {
        yield dispatch('core/block-editor').removeBlock(
            bibliographyBlock.clientId,
        );
    }
}
github Automattic / vip-go-mu-plugins-built / jetpack / extensions / blocks / contact-form / edit.js View on Github external
const blocks = map( innerBlocksTemplate, ( [ name, attr, innerBlocks = [] ] ) =>
			createBlock( name, attr, createBlocksFromInnerBlocksTemplate( innerBlocks ) )
		);
github WordPress / gutenberg / core-blocks / file / index.js View on Github external
transform: ( attributes ) => {
					return createBlock( 'core/file', {
						href: attributes.src,
						fileName: attributes.caption && attributes.caption.join(),
						textLinkHref: attributes.src,
						id: attributes.id,
					} );
				},
			},
github godaddy-wordpress / coblocks / src / blocks / gallery-masonry / transforms.js View on Github external
transform: ( attributes ) => (
				createBlock( 'core/gallery', {
					...GalleryTransforms( attributes ),
				} )
			),
		},
github front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / block-library / build-module / cover / index.js View on Github external
transform: ({ title, url, align, id }) => (
          createBlock('core/image', {
            caption: title,
            url,
            align,
            id,
          })
        ),
      },