Skip to content

Playground npm package #147

Description

@adamziel

Description

It would be great to build custom apps with WordPress Playground like this:

import { Playground } from '@wordpress/playground';

function MyApp() {
    const playground = useRef( null );
    
    function login() {
        await playground.navigate( '/wp-login.php' );
        await playground.navigate( '/wp-login.php', {
		method: 'POST',
		data: {
			log: 'admin',
			pwd: 'password',
			rememberme: 'forever',
		}
        } );
    }
    
    return (
        <div>
            <h2>My custom app</h2>
            <button onClick={ login }>Login as admin</button>
            <Playground 
                 php="7.4"
                 wp="6.0"
                 plugins={{"gutenberg": "latest"}}
                 onNavigate={ handleNewUrl }
                 ref={ playground } />
        </div>
    );
}

Technically, all these features are already implemented. There's just no package with neat API to import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions