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

Multiple headings in the toolbox #92

Closed
Vinze opened this issue May 10, 2023 · 4 comments
Closed

Multiple headings in the toolbox #92

Vinze opened this issue May 10, 2023 · 4 comments

Comments

@Vinze
Copy link

Vinze commented May 10, 2023

On the homepage of Editor.js you can see multiple levels of headings in the screenshot, see:

afbeelding

But after installing Editor.js and the header plugin I only have one "Heading" item in the toolbox. I found the following pull request but I guess this isn't merged into the default branch? When simply doing a npm i --save @editorjs/header I get the following:

afbeelding

How do I enable this feature?

@nhuanhoangduc
Copy link

Try creating a custom Header class

class CustomHeader extends Header {
  static get toolbox() {
    return [
      {
        icon: IconH1,
        title: 'Heading 1',
        data: {
          level: 1,
        },
      },
      {
        icon: IconH2,
        title: 'Heading 2',
        data: {
          level: 2,
        },
      },
      {
        icon: IconH3,
        title: 'Heading 3',
        data: {
          level: 3,
        },
      },
    ]
  }
}

@trig79
Copy link

trig79 commented May 27, 2023

this worked for me, depending on where you extend you may need to import the icons:
import {IconH1, IconH2, IconH3} from '@codexteam/icons'

@Vinze
Copy link
Author

Vinze commented May 30, 2023

That seems to work, thank you!

Would be nice be able to configure this through an configuration option.

@Vinze Vinze closed this as completed May 30, 2023
@TatianaFomina
Copy link
Contributor

That seems to work, thank you!

Would be nice be able to configure this through an configuration option.

There is such ability, read official article for more info 👉 https://codex.so/editorjs-toolbox

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

4 participants