Commit 6fed9ce9 by Рамис

add onChange func

parent d79674e6
...@@ -6,7 +6,9 @@ import 'react-ag-qeditor/dist/index.css' ...@@ -6,7 +6,9 @@ import 'react-ag-qeditor/dist/index.css'
const App = () => { const App = () => {
return <div style={{padding:40}}> return <div style={{padding:40}}>
<QEditor /> <QEditor value={'<p>asds</p>'} onChange={(value)=>{
console.log('sads', value);
}} />
</div> </div>
} }
......
...@@ -187,7 +187,7 @@ export default class QEditor extends React.Component { ...@@ -187,7 +187,7 @@ export default class QEditor extends React.Component {
window.katex = katex; window.katex = katex;
if ( ! this.state.init) { if ( !this.state.init) {
return null; return null;
} }
return ( return (
...@@ -198,7 +198,9 @@ export default class QEditor extends React.Component { ...@@ -198,7 +198,9 @@ export default class QEditor extends React.Component {
ref={ref => this.quillRef = ref} ref={ref => this.quillRef = ref}
defaultValue={value} defaultValue={value}
theme="snow" theme="snow"
onChange={(value) => {console.log(value)}} onChange={value => {
this.props.onChange(value)
}}
modules={this.modules} modules={this.modules}
formats={this.formats} formats={this.formats}
onChangeSelection={(range, source, editor) => { onChangeSelection={(range, source, editor) => {
...@@ -240,5 +242,7 @@ export default class QEditor extends React.Component { ...@@ -240,5 +242,7 @@ export default class QEditor extends React.Component {
QEditor.defaultProps = { QEditor.defaultProps = {
maxWidth: 'auto', maxWidth: 'auto',
maxHeight: 1000 maxHeight: 1000,
onChange: ()=>{},
lang: 'ru'
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment