import PropTypes from 'prop-types'; import React from 'react'; import { List } from 'immutable'; import ImmutablePropTypes from 'react-immutable-proptypes'; import c from 'classnames'; import { Dropdown, DropdownItem, Toggle, Icon } from 'UI'; import ToolbarButton from './ToolbarButton'; export default class Toolbar extends React.Component { static propTypes = { buttons: PropTypes.object, onToggleMode: PropTypes.func.isRequired, rawMode: PropTypes.bool, plugins: ImmutablePropTypes.map, onSubmit: PropTypes.func, onAddAsset: PropTypes.func, getAsset: PropTypes.func, disabled: PropTypes.bool, className: PropTypes.string, }; constructor(props) { super(props); this.state = { activePlugin: null, }; } render() { const { onMarkClick, onBlockClick, onLinkClick, selectionHasMark, selectionHasBlock, selectionHasLink, onToggleMode, rawMode, plugins, onAddAsset, getAsset, disabled, onSubmit, className, } = this.props; const { activePlugin } = this.state; /** * Because the toggle labels change font weight for active/inactive state, * we need to set estimated widths for them to maintain position without * moving other inline items on font weight change. */ const toggleOffLabel = 'Rich text'; const toggleOffLabelWidth = '62px'; const toggleOnLabel = 'Markdown'; const toggleOnLabelWidth = '70px'; return (
} > {plugins && plugins.toList().map((plugin, idx) => ( onSubmit(plugin.get('id'))} /> ))}
{toggleOffLabel} {toggleOnLabel}
); } }