Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools not working ? new way to import in React ? #2753

Open
chuckdu21 opened this issue Jul 2, 2024 · 1 comment
Open

Tools not working ? new way to import in React ? #2753

chuckdu21 opened this issue Jul 2, 2024 · 1 comment

Comments

@chuckdu21
Copy link

Hi, i just started a new react project with EditorJS.

I'm facing two issues:

  • I got two editors on my page. I saw one post saying to remove StrictMode from React but not working.
  • Header tools not appears in the editor toolbar. Tried to do like the example from this git: import Header from '@editorjs/header' but it says there is no module header... Btw i had to type as unknown as ToolConstructable to avoid typing error (i'm using tsx)

Here is my code:

import EditorJS from '@editorjs/editorjs'
import type { ToolConstructable } from '@editorjs/editorjs'
import Header from '@editorjs/editorjs'
import './App.css'

function App() {

  const editeur = new EditorJS({
    holder: 'editorjs',
    tools: {
      header:  Header as unknown as ToolConstructable
    }
  })
  return (
    <div className='App'>
      <div id='editorjs' className='editor' />
    </div>
  )
}
export default App;

What am i doing wrong ?

@SebastianMuszynski
Copy link

Hey @chuckdu21,
make sure to install @editorjs/header package first.

Then import it using the following code:

import Header from '@editorjs/header'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants