question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using JSX tools render method

See original GitHub issue

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
      }}
    />;
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
natterstefancommented, Jan 24, 2020

Hi @hata6502, you can find a solution (“workaround”) here already: https://github.com/codex-team/editor.js/issues/946#issuecomment-555760936.

Note: this issue is already closed, and a new one discusses this issue.

1reaction
gohaberegcommented, Nov 12, 2019

Hey @natterstefan, it seems, some of inner Editor.js handlers stops event propagation. Definitely we should look into this.

If I select button’s content it works ok: Screen-Recording-2019-11-12-at-12 55 59

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rendering Elements - React
With our knowledge so far, the only way to update the UI is to create a new element, and pass it to root.render()...
Read more >
React JSX and Rendering - EASEOUT
Learn about JSX and rendering in React. ... And while it's not mandatory, it's certainly an extremely useful tool — it does a...
Read more >
How To Debug React Components Using React Developer ...
A quick way to see how components change each other is to enable highlighting when a component is re-rendered. This will give you...
Read more >
JSX in React – Explained with Examples - freeCodeCamp
class JSXDemo extends React.Component { render() { return <h1>This is ...
Read more >
How to Render React with optimization - LoginRadius Blog
In React, the render() method is the only required method in a class component and is responsible for describing the view to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found