uiwjs / react-md-editor

A simple markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-md-editor
MIT License
2.2k stars 160 forks source link

How to control the display of functions in toolbar by declaring command? #221

Closed goudanz closed 3 years ago

goudanz commented 3 years ago

I want to do this.

eg:

const commands = ['bold','codeBlock','link','code','image'];

When I set this up, only these are displayed in the toolbar!

goudanz commented 3 years ago

like this:

https://braft.margox.cn/demos/custom


    const controls = [
        'undo', 'redo', 'headings', 'separator','text-color', 'bold', 'separator', 'text-indent', 'text-align', 'separator',
        'list-ul', 'list-ol', 'blockquote', 'code', 'separator','link', 'media', 'separator','clear'
    ]

<BraftEditor
        style={{border: '1px solid #d1d1d1',borderRadius: '2px',height: 400}}
        contentStyle={{height: 306, overflowY: 'scroll'}}
        controls={controls}
        extendControls={extendControls}
        value={editor}
        defaultValue={defaultValue}
        media={{uploadFn: myUploadFn}}
        onChange={onEditorContentChange}
        onFocus={onFocus}
    />
goudanz commented 3 years ago

thanks,I know the solution.

goudanz commented 3 years ago

i found the way from here : https://github.com/uiwjs/react-md-editor/issues/213#issuecomment-885726737