Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ( function( wp ) {
- var el = wp.element.createElement;
- var withState = wp.compose.withState;
- const MyModal = withState( {
- isOpen: false
- } )( ( {
- isOpen,
- setState
- } ) => el( "div", null, el( wp.components.Button, {
- isDefault: true,
- onClick: () => setState( {
- isOpen: true
- } )
- }, "Open Modal" ), isOpen ? el( wp.components.Modal, {
- title: "Go https://otshelnik-fm.ru/",
- onRequestClose: () => setState( {
- isOpen: false
- } )
- },
- el( wp.components.Button, {
- isDefault: true,
- onClick: () => setState( {
- isOpen: false
- } )
- }, "My custom close button" ) ) : null ) );
- wp.richText.registerFormatType(
- 'my-custom-format/sample-output', {
- title: 'Sample output',
- tagName: 'samp',
- className: null,
- edit: MyModal
- }
- );
- } )( window.wp );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement