Skip to content

Using JSX tools render method #849

@vpetrushenko

Description

@vpetrushenko

Hi! I would like to understand if it is possible for tools render method to return JSX?

For example, I want each paragraph of editor to be my own (already written) React component, which is basically <div> with contenteditable attribute, but also with a lots of logic inside. Ideally I would love something like this:

class CustomParagraph {
  // other methods here

  render() {
    return <EditableDiv/>; // where EditableDiv is a big component
  }
}

export class NewEditableDiv extends React.Component {
  render() {
    return <EditorJS
      tools={{
        paragraph: CustomParagraph
      }}
    />;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions