Match up attributes to postMessage
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import * as React from 'react';
|
||||
import { Button, Modal, FocusableIframe } from '@wordpress/components';
|
||||
|
||||
import { baseUrl } from '../globals';
|
||||
import { baseUrl } from '@/globals';
|
||||
|
||||
type DialogProps = {
|
||||
onSelectForm: Function;
|
||||
@@ -34,6 +34,7 @@ class SelectDialog extends React.Component<DialogProps, DialogState> {
|
||||
handlePostMessage = ( event: MessageEvent ) => {
|
||||
console.log( 'PostMessage recieved:', event.data );
|
||||
this.props.onSelectForm( event.data );
|
||||
this.setState({ isOpen: false });
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -43,8 +44,16 @@ class SelectDialog extends React.Component<DialogProps, DialogState> {
|
||||
Choose a form
|
||||
</Button>
|
||||
{ this.state.isOpen && (
|
||||
<Modal title="Cognito Forms" className="cognito-modal" onRequestClose={ () => this.setState( { isOpen: false } ) } shouldCloseOnClickOutside={ false }>
|
||||
<FocusableIframe style={ { width: '500px', height: '500px', display: 'block' } } src={ `${ baseUrl }/integrations/cms` }></FocusableIframe>
|
||||
<Modal
|
||||
title="Cognito Forms"
|
||||
className="cognito-modal"
|
||||
onRequestClose={ () => this.setState( { isOpen: false } ) }
|
||||
shouldCloseOnClickOutside={ false }
|
||||
>
|
||||
<FocusableIframe
|
||||
style={ { width: '500px', height: '500px', display: 'block' } }
|
||||
src={ `${ baseUrl }/integrations/cms` }
|
||||
></FocusableIframe>
|
||||
</Modal>
|
||||
) }
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user