Created
October 9, 2018 05:28
-
-
Save deanshub/98483b2264f316bfb5108460b085ccb1 to your computer and use it in GitHub Desktop.
how to add a button to draft inline toolbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usualy in the constructor because there should be instance per editor | |
const inlineToolbarPlugin = createInlineToolbarPlugin({ | |
structure: [ | |
BoldButton, | |
ItalicButton, | |
UnderlineButton, | |
CodeButton, | |
Separator, | |
AddVideoButton, | |
], | |
}) | |
const { InlineToolbar } = inlineToolbarPlugin | |
this.plugins = [ | |
// focusPlugin, | |
inlineToolbarPlugin, | |
// emojiPlugin, | |
mentionPlugin, | |
hashtagPlugin, | |
linkifyPlugin, | |
videoPlugin, | |
cardsPlugin, | |
rangePlugin, | |
] | |
this.InlineToolbar = InlineToolbar | |
// in the render | |
<InlineToolbar/> | |
<Editor | |
editorState={post.content} | |
onChange={::this.postContentChange} | |
placeholder={placeholder} | |
plugins={plugins} | |
readOnly={readOnly} | |
ref={::this.refEditor} | |
/> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment