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

Do not understand documanetation #2617

Closed
fzsf163 opened this issue Feb 15, 2024 · 3 comments
Closed

Do not understand documanetation #2617

fzsf163 opened this issue Feb 15, 2024 · 3 comments

Comments

@fzsf163
Copy link

fzsf163 commented Feb 15, 2024

The question.
How to use types for tools?
Why and how the question has come up.
If you use TypeScript you need to explicitly specify that typeof Tool implements BlockToolConstructable or InlineToolConstructable

How and where ?

import EditorJS, {
  BlockToolConstructable,
  InlineToolConstructable,
} from "@editorjs/editorjs";
import Header from "@editorjs/header";
import List from "@editorjs/list";
export default function Editor() {
  const editor = new EditorJS({
    holder: "editorjs",
    tools: {
      header: {
        class: Header,
      },
    },
  });
  return <div id="editorjs"></div>;
}

where do you add it? 
@neSpecc
Copy link
Member

neSpecc commented Feb 15, 2024

@fzsf163
Copy link
Author

fzsf163 commented Feb 15, 2024

Maybe this example will help https://github.com/codex-team/editor.js/blob/next/test/cypress/fixtures/tools/ToolMock.ts

no sir it does not, i will just use //@ts-ignore

@neSpecc
Copy link
Member

neSpecc commented Feb 15, 2024

See #2143

@neSpecc neSpecc closed this as completed Feb 15, 2024
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