React = require 'react' module.exports = ContenteditableToolbar = React.createClass render: -> style = display: @state.show and 'initial' or 'none'
getInitialState: -> show: false componentDidUpdate: (lastProps, lastState) -> if !lastState.show and @state.show @refs.toolbar.getDOMNode().focus() onClick: (event) -> cmd = event.currentTarget.getAttribute 'data-command-name' document.execCommand(cmd, false, null) true onBlur: (event) -> target = event.nativeEvent.relatedTarget if target? and target.getAttribute 'data-command-name' return @setState show: false