File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ It accepts these props for styling:
111111|className|PropTypes.string|An additional class that is added to the Content Editable
112112|ignoreTabKey|PropTypes.bool|Makes the editor ignore tab key presses so that keyboard users can tab past the editor without getting stuck
113113|style|PropTypes.object|Additional styles for the Content Editable
114+ |onChange|PropTypes.function|Accepts a callback that is called when the user makes changes
114115
115116This component renders a Prism.js editor underneath it and also renders all of Prism’s
116117styles inside a ` style ` tag.
Original file line number Diff line number Diff line change 11import React from 'react'
2+ import PropTypes from 'prop-types'
23import { LiveContextTypes } from './LiveProvider'
34import Editor from '../Editor'
45
56const LiveEditor = ( props , { live } ) => (
67 < Editor
78 { ...props }
89 code = { live . code }
9- onChange = { live . onChange }
10+ onChange = { code => {
11+ live . onChange ( code )
12+
13+ if ( typeof props . onChange === 'function' ) {
14+ props . onChange ( code )
15+ }
16+ } }
1017 />
1118)
1219
1320LiveEditor . contextTypes = LiveContextTypes
21+ LiveEditor . propTypes = { onChange : PropTypes . function }
1422
1523export default LiveEditor
1624
You can’t perform that action at this time.
0 commit comments