Skip to content

Module to parse content blocks from EditorJS format to Preact components

Notifications You must be signed in to change notification settings

narcitymedia/editorjs-content-react

Repository files navigation

EditorJS Content React

Module to parse content blocks from EditorJS format to React components

Usage

import { getReactComponentForBlock } from 'editorjs-content-react';

const contentBlock = {
    type: "header",
    // Can be any unique string, format is not relevant
    contentUniqueId: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    data: {
        level: 3,
        text: "Heading"
    }
};

const BaseBlockComponent = getReactComponentForBlock(contentBlock);

const Content: React.FC<ContentBlock> = props => (
    <BaseBlockContent {...props} />
);

Run the tests

    npm test

Run Storybook

    cd storybook/component-showcase/
    npm run storybook

About

Module to parse content blocks from EditorJS format to Preact components

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published