add list and code toolbar buttons
This commit is contained in:
parent
ae56ef6dda
commit
24caeadfa4
@ -57,10 +57,14 @@ export default class Toolbar extends React.Component {
|
||||
const { activePlugin } = this.state;
|
||||
|
||||
const buttonsConfig = [
|
||||
{ label: 'Header 1', icon: 'h1', state: buttons.h1 },
|
||||
{ label: 'Header 2', icon: 'h2', state: buttons.h2 },
|
||||
{ label: 'Bold', icon: 'bold', state: buttons.bold },
|
||||
{ label: 'Italic', icon: 'italic', state: buttons.italic },
|
||||
{ label: 'Code', icon: 'code-alt', state: buttons.code },
|
||||
{ label: 'Header 1', icon: 'h1', state: buttons.h1 },
|
||||
{ label: 'Header 2', icon: 'h2', state: buttons.h2 },
|
||||
{ label: 'Bullet List', icon: 'list-bullet', state: buttons.list },
|
||||
{ label: 'Numbered List', icon: 'list-numbered', state: buttons.listNumbered },
|
||||
{ label: 'Code Block', icon: 'code', state: buttons.codeBlock },
|
||||
{ label: 'Link', icon: 'link', state: buttons.link },
|
||||
];
|
||||
|
||||
|
@ -242,7 +242,7 @@ const RULES = [
|
||||
},
|
||||
{
|
||||
serialize(entity, children) {
|
||||
if (!['bulleted-list', 'unordered-list'].includes(entity.type)) {
|
||||
if (!['bulleted-list', 'numbered-list'].includes(entity.type)) {
|
||||
return;
|
||||
}
|
||||
return NODE_COMPONENTS[entity.type]({ children });
|
||||
@ -455,11 +455,15 @@ export default class Editor extends Component {
|
||||
<Toolbar
|
||||
selectionPosition={selectionPosition}
|
||||
buttons={{
|
||||
h1: this.getButtonProps('heading-one', true),
|
||||
h2: this.getButtonProps('heading-two', true),
|
||||
bold: this.getButtonProps('bold'),
|
||||
italic: this.getButtonProps('italic'),
|
||||
code: this.getButtonProps('code'),
|
||||
link: this.getButtonProps('link'),
|
||||
h1: this.getButtonProps('heading-one', true),
|
||||
h2: this.getButtonProps('heading-two', true),
|
||||
list: this.getButtonProps('bulleted-list', true),
|
||||
listNumbered: this.getButtonProps('numbered-list', true),
|
||||
codeBlock: this.getButtonProps('code', true),
|
||||
}}
|
||||
onToggleMode={this.handleToggle}
|
||||
plugins={plugins}
|
||||
|
Loading…
x
Reference in New Issue
Block a user