import { actionButtonIcon } from 'includes/icons'; import TemplateRender from 'includes/templateRender'; const { __ } = wp.i18n; const { PanelBody, BaseControl, Icon, Button, TextControl, SelectControl, ToggleControl, Flex, FlexBlock, FlexItem, __experimentalInputControl, __experimentalRadioGroup, __experimentalRadio, } = wp.components; let { InputControl, RadioGroup, Radio } = wp.components; InputControl = InputControl || __experimentalInputControl; RadioGroup = RadioGroup || __experimentalRadioGroup; Radio = Radio || __experimentalRadio; const { registerBlockType } = wp.blocks; const { InspectorControls, MediaUpload, URLInput } = wp.blockEditor; const { RawHTML, useState } = wp.element; if ( 'jet-popup' === window.JetPopupBlockEditorConfig.postType ) { registerBlockType( 'jet-popup/action-button', { title: __( 'Popup Action Button' ), icon: actionButtonIcon, category: 'layout', className: 'jet-popup-action-button', supports: { html: false }, attributes: JetPopupBlockEditorConfig.registeredBlockAttrs[ 'action-button' ] || {}, example: { attributes: { blockPreview: true, }, viewportWidth: 625 }, edit: class extends wp.element.Component { render() { const props = this.props; return [ props.isSelected && ( { props.setAttributes( { actionType: value } ) } } /> { props.setAttributes( { buttonAlignment: value } ) } } defaultChecked="center" > { props.setAttributes( { buttonText: value } ) } } />
{ props.attributes.iconUrl && } { props.setAttributes( { iconId: media.id } ) props.setAttributes( { iconUrl: media.url } ) } } allowedTypes={ [ 'image/svg+xml' ] } value={ props.attributes.iconId } render={ ( { open } ) => ( )} /> { props.attributes.iconUrl && }
{ 'link' === props.attributes.actionType && { props.setAttributes( { buttonLink: url } ); } } /> { props.setAttributes( { buttonLinkBlank: ! props.attributes.buttonLinkBlank } ); }} /> { __( 'Open in new window', 'jet-popup' ) } { props.setAttributes( { buttonLinkNofollow: ! props.attributes.buttonLinkNofollow } ); }} /> { __( 'Add nofollow', 'jet-popup' ) } }
),
]; } }, save: () => { return null; } }); }