@@ -35,11 +35,19 @@ const HeaderGroup = (props) => (
3535 </ ul >
3636) ;
3737
38- const HeaderItem = ( { icon, onClick} ) => {
38+ const HeaderItem = ( { icon, onClick, tooltip } ) => {
3939 var x = React . isValidElement ( icon ) ? icon : < i className = { `fa fa-${ icon } ` } aria-hidden = "true" > </ i >
40+
41+ let buttonProps = { } ;
42+ if ( tooltip ) {
43+ buttonProps = {
44+ 'aria-label' : tooltip ,
45+ className : 'tooltipped'
46+ }
47+ }
4048 return (
4149 < li className = "mde-header-item" >
42- < button type = "button" onClick = { onClick } >
50+ < button type = "button" { ... buttonProps } onClick = { onClick } >
4351 { x }
4452 </ button >
4553 </ li >
@@ -117,17 +125,17 @@ class ReactMde extends Component {
117125 < div className = "react-mde" >
118126 < div className = "mde-header" >
119127 < HeaderGroup >
120- < HeaderItem icon = "bold" onClick = { this . getCommandHandler ( ReactMdeCommands . makeBold ) . bind ( this ) } />
121- < HeaderItem icon = "italic" onClick = { this . getCommandHandler ( ReactMdeCommands . makeItalic ) . bind ( this ) } />
128+ < HeaderItem icon = "bold" tooltip = "Add bold text" onClick = { this . getCommandHandler ( ReactMdeCommands . makeBold ) . bind ( this ) } />
129+ < HeaderItem icon = "italic" tooltip = "Add italic text" onClick = { this . getCommandHandler ( ReactMdeCommands . makeItalic ) . bind ( this ) } />
122130 </ HeaderGroup >
123131 < HeaderGroup >
124- < HeaderItem icon = "link" onClick = { this . getCommandHandler ( ReactMdeCommands . makeLink ) . bind ( this ) } />
125- < HeaderItem icon = "quote-right" onClick = { this . getCommandHandler ( ReactMdeCommands . makeQuote ) . bind ( this ) } />
126- < HeaderItem icon = "picture-o" onClick = { this . getCommandHandler ( ReactMdeCommands . makeImage ) . bind ( this ) } />
132+ < HeaderItem icon = "link" tooltip = "Insert a link" onClick = { this . getCommandHandler ( ReactMdeCommands . makeLink ) . bind ( this ) } />
133+ < HeaderItem icon = "quote-right" tooltip = "Insert a quote" onClick = { this . getCommandHandler ( ReactMdeCommands . makeQuote ) . bind ( this ) } />
134+ < HeaderItem icon = "picture-o" tooltip = "Insert a picture" onClick = { this . getCommandHandler ( ReactMdeCommands . makeImage ) . bind ( this ) } />
127135 </ HeaderGroup >
128136 < HeaderGroup >
129- < HeaderItem icon = "list-ul" onClick = { this . getCommandHandler ( ReactMdeCommands . makeUnorderedList ) . bind ( this ) } />
130- < HeaderItem icon = "list-ol" onClick = { this . getCommandHandler ( ReactMdeCommands . makeOrderedList ) . bind ( this ) } />
137+ < HeaderItem icon = "list-ul" tooltip = "Add a bulleted list" onClick = { this . getCommandHandler ( ReactMdeCommands . makeUnorderedList ) . bind ( this ) } />
138+ < HeaderItem icon = "list-ol" tooltip = "Add a numbered list" onClick = { this . getCommandHandler ( ReactMdeCommands . makeOrderedList ) . bind ( this ) } />
131139 </ HeaderGroup >
132140 </ div >
133141 < div className = "mde-text" >
0 commit comments