globocom / megadraft

Megadraft is a Rich Text editor built on top of Facebook's Draft.JS featuring a nice default base of components and extensibility

Home Page:http://megadraft.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide dropdown menu all together?

admc opened this issue · comments

Greetings, cool project!

I was wondering if there was a simple way to hide the expandable menu completely and only show user options when text is selected.

Thanks!

Hi Adam, thank you! :)

Yes, both the sidebar and the toolbar can be overwritten in the Editor if you want.

The sidebarRendererFn prop can be used when creating an Editor instance to provide your own custom sidebar, the one that comes up in the left with the plugin list. You can pass an empty component here if you don't want the sidebar to be rendered at all. But if you do want to use a custom sidebar just note that the sidebarRendererFn takes a prop object with the following properties:
plugins: array of valid plugins
editorState: DraftJS editorState object
onChange: handler for editorState changes

And the Toolbar prop can be used to pass a component for it to render instead of the rich text toolbar that shows up when text is selected (it also can be an empty component if you don't want it to render anything). And you can add custom actions if you want to, using the actions prop.

You can find some examples of usage of the props I mentioned above in this page:
http://megadraft.io/#/docs/customization

Hope this helps. And if you need help with anything else, just let us know :)

Perfect, thanks so much - worked like a charm.