PlainText in Modal
-
Hi,
I am trying to create a popup that will have a PlainText component.
In this PlainText component you can add some text that would update attributes onChange.
I took the code from WordPress documentation and added PlainText component to it.
What I want to do might be bad practise.
The problem is that as soon as I start typing in the text field the Modal closes. When I open it again the character is there and if I try to type again the same happens.Thank you
Here is my code
const MyModal = withState( { isOpen: false, } )( ( { isOpen, setState } ) => ( <div> <Button isDefault onClick={ () => setState( { isOpen: true } ) }>Open Modal</Button> { isOpen && ( <div> <Modal title="This is my modal" onRequestClose={ () => setState( { isOpen: false } ) } shouldCloseOnClickOutside="false"> <PlainText onChange={ (content) => setAttributes( { arielButton: content } ) } value={ attributes.arielButton } /> </Modal> </div> ) } </div> ) );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘PlainText in Modal’ is closed to new replies.