GithubHelp home page GithubHelp logo

isabella232 / wp-graphql-block-editor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wp-graphql/wp-graphql-block-editor

0.0 0.0 0.0 76 KB

EXPERIMENTAL plugin extending WPGraphQL to support querying (Gutenberg) Blocks as data, using Server Side Block registries to map Blocks to the GraphQL Schema.

PHP 100.00%

wp-graphql-block-editor's Introduction

WPGraphQL Block Editor

This is an experimental plugin to work toward compatiblity between the WordPress Gutenberg Block Editor and WPGraphQL, based on Server Side registration of Gutenberg Blocks.

This stems from this blog post: https://www.wpgraphql.com/2021/03/09/gutenberg-and-decoupled-applications/

And this Github issue: wp-graphql/wp-graphql#1764

Problems

Server Awareness

Gutenberg is a JavaScript application where Blocks are registered in JavaScript and the WordPress server doesn't know what a block is, what attributes a block can have, etc.

Without server awareness of Gutenberg blocks, APIs such as WP-CLI, the WP REST API and WPGraphQL can't expose blocks in a scalable way for decoupled clients to interact with.

Query Blocks as Data

Developers that are working with WordPress in a decoupled context, with WPGraphQL specifically, have expressed a desire to want to query Gutenberg Blocks as data, then use the data in Component-based architectures with Next, Vue, React Native, and similar.

Instead of querying a block of unpredictable markup and parsing it, or querying unpredictable JSON and parsing it, developers want to see what Blocks are available as GraphQL Types, then specify the exact fields they want for their components.

Server Validation

Currently, since blocks are largely client-side only and the server doesn't know about their existence, the server isn't able to validate input from the client before the data is saved.

I don't think we'll be able to solve this for Gutenberg via this plugin, but we might be able to solve it for decoupled clients interested in using GraphQL Mutations to post data back to WordPress and modify blocks.

wp-graphql-block-editor's People

Contributors

jasonbahl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.