megahertz / react-simple-wysiwyg

Simple and lightweight React WYSIWYG editor
https://megahertz.github.io/react-simple-wysiwyg/
MIT License
149 stars 25 forks source link

Custom toolbar not working #33

Closed Joci933 closed 9 months ago

Joci933 commented 9 months ago

I wanted to customize the toolbar according to the readme, but the default toolbar is displayed.

import { 
  BtnBold, 
  BtnItalic, 
  createButton, 
  Editor, 
  EditorProvider, 
  Toolbar
} from 'react-simple-wysiwyg';

const BtnAlignCenter = createButton('Align center', '≡', 'justifyCenter');

export default function CustomEditor({ value, onChange }) {
  return (
    <EditorProvider>
      <Editor value={value} onChange={onChange}>
        <Toolbar>
          <BtnBold />
          <BtnItalic />
          <BtnAlignCenter />
        </Toolbar>
      </Editor>
    </EditorProvider>
  );
}

image (6)

Chrome: 118.0.5993.88 react-simple-wysiwyg version: 3.0.2

Joci933 commented 9 months ago

But the Toolbar is display, when I moved the toolbar code after the

image (7)

Joci933 commented 9 months ago

Ah, that was my fault, sorry.