0.1.7 • Published 7 years ago

draft-js-plugin-editor-toolbar-picker v0.1.7

Weekly downloads
194
License
MIT
Repository
github
Last release
7 years ago

draft-js-plugin-editor-toolbar-picker

Picker component for draft-js-static-toolbar-plugin and draft-js-inline-toolbar-plugin

Usage

Install via npm:

$ npm i draft-js-plugin-editor-toolbar-picker

And use in your project:

import {
	BlockquoteButton,
	BoldButton,
	CodeBlockButton,
	CodeButton,
	HeadlineOneButton,
	HeadlineThreeButton,
	HeadlineTwoButton,
	ItalicButton,
	OrderedListButton,
	UnderlineButton,
	UnorderedListButton
} from 'draft-js-buttons'

import createPicker, { createTriggerButton } from 'draft-js-plugin-editor-toolbar-picker'
const Picker = createPicker({
	triggerItem: createTriggerButton({ child: 'H' }),
	items: [
		HeadlineOneButton,
		HeadlineTwoButton,
		HeadlineThreeButton
	]
	/* 
	other options:
	autoClose: boolean -> Auto close if click another location, default `true`
	closeButton: ReactNode -> Close button when `autoClose` is `false`
	*/
})

const toolbarPlugin = createToolbarPlugin({
	structure: [
		BoldButton,
		ItalicButton,
		UnderlineButton,
		CodeButton,
		Separator,
		Picker,   // Use `Picker` as an item button
		UnorderedListButton,
		OrderedListButton,
		BlockquoteButton,
		CodeBlockButton
	]
})

License

MIT

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago