editor-js / header

Header Tool for Editor.js 2.0
MIT License
101 stars 122 forks source link

Toolbar Title override #71

Closed WowItsDoge closed 2 years ago

WowItsDoge commented 2 years ago

Hi, your module and editor.js is awesome!

Can you give me an example, how to override the Toolbar title? I guess the property "toolbox" has to be used.

image

header: {
        class: Header,
        shortcut: 'CMD+SHIFT+H',
        config: {
            placeholder: 'Enter a header',
            levels: [2, 3, 4],
            defaultLevel: 3
          },
        toolbox: 'example'
      }
neSpecc commented 2 years ago

Hi. There are two ways.

  1. Specify own toolbox title (and/or icon)
const editor = new EditorJS({
  tools: {
    header: {
      class: Header,
      toolbox: {
        title: 'My own title',
        // icon: '<svg>...</svg>'
      }
    }
  }
})
  1. Using the i18n option
const editor = new EditorJS({
  // ...
  i18n: {
    messages: {
      toolNames: {
        'Heading': 'My own title'
      }
    }
  },
})
WowItsDoge commented 2 years ago

Thank you for the code examples, it works!

Maybe it should be linked in the documentation, then it would be simpler for other users to find.