Giter Club home page Giter Club logo

Comments (4)

jxnblk avatar jxnblk commented on May 14, 2024 1

This sounds like it covers most of the bases. Here's a few thoughts:

// I don't think there's much value in using context here
<Blocks.Provider theme={theme} blockComponents={components}>
  <Blocks.Editor />
</Blocks.Provider>
// E.g. using props seems more standard/straight-forward
<Editor theme={theme} components={components} />

As for the schema and serialization, I think it could make sense to treat all blocks as the jsx type in the Slate schema, and use an addition data.type property or similar to add the root component name, which can be checked against the components provided to the Editor. If we're talking about using static properties to define the shape of the editing forms anyway, we'll need to check that in the runtime. We probably will still need someway to know whether a JSX block accepts children or not though... I think I have enough to put together a proof of concept of this if this doesn't make sense

from blocks.

johno avatar johno commented on May 14, 2024 1

Updated the proposed API to <Editor theme={theme} components={components} /> 👍

from blocks.

johno avatar johno commented on May 14, 2024

In order to make things simpler we're now opting (as of #17) to only use two custom block types: jsx and jsx-void which a block extends. The metadata needed for rendering and exposing the form can be added to the node's data field.

{
  type: 'jsx-void',
  data: {
    type: 'YouTube',
    props: {}
  }
}

from blocks.

johno avatar johno commented on May 14, 2024

Addressed by #17 and #19

from blocks.

Related Issues (20)

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.