/**
* BLOCK: cognito
*
* Allows for the embedding of Cognito Forms into the Gutenburg editor with an interactive dialog to choose a form to embed.
*/
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import { PlainText } from '@wordpress/editor';
import { Button, Placeholder, ExternalLink } from '@wordpress/components';
import { BlockIcon } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import './editor.scss';
import './style.scss';
import SelectDialog from './select-dialog'
const CogIcon = ;
/**
* Register: aa Gutenberg Block.
*
* Registers a new block provided a unique name and an object defining its
* behavior. Once registered, the block is made editor as an option to any
* editor interface where blocks are implemented.
*
* @link https://wordpress.org/gutenberg/handbook/block-api/
* @param {string} name Block name.
* @param {Object} settings Block settings.
* @return {?WPBlock} The block, if it has been successfully
* registered; otherwise `undefined`.
*/
registerBlockType( 'cognito-forms/cognito-embed', {
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
title: __( 'Cognito Forms' ), // Block title.
icon: CogIcon,
category: 'embed', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
keywords: [
__( 'Cognito' ),
__( 'Cognito Forms' ),
__( 'Form' ),
],
attributes: {
url: {
source: 'text',
selector: '.cognito__form'
}
},
/**
* The edit function describes the structure of your block in the context of the editor.
* This represents what the editor will render when the block is used.
*
* The "edit" property must be a valid function.
*
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
*
* @param {Object} props Props.
* @returns {Mixed} JSX Component.
*/
edit: ( props ) => {
return (
— Hello from the frontend.
CGB BLOCK: cognito is a new Gutenberg block.
It was created via{ ' ' }
create-guten-block
.