组件化 富文本

This commit is contained in:
wangsongsole 2022-06-16 18:07:07 +08:00
parent 6518594631
commit 69cdd31340
2 changed files with 6 additions and 3 deletions

View File

@ -1031,6 +1031,7 @@ export default class addKnockGold extends Component {
}} }}
width='520px' width='520px'
text={this.state.model.instruction} text={this.state.model.instruction}
limitLength={500}
/> />
</FormItem> </FormItem>
</Form> </Form>

View File

@ -34,8 +34,8 @@ export default class wangeditor extends React.Component {
// //
self.props.setEdittext('') self.props.setEdittext('')
} }
if (text.length > 500) { if (text.length > self.props.limitLength) {
let str = text.slice(0, 500) let str = text.slice(0, self.props.limitLength)
self.setState({ editorHtml: str }) self.setState({ editorHtml: str })
editor.txt.html(str) editor.txt.html(str)
self.props.setEdittext(str) self.props.setEdittext(str)
@ -55,7 +55,9 @@ export default class wangeditor extends React.Component {
return ( return (
<div className='countBox_par'> <div className='countBox_par'>
<div id='wangeditorDom' style={{ width: this.props.width }}></div> <div id='wangeditorDom' style={{ width: this.props.width }}></div>
<p className='countBox'>{this.state.count + '/' + 500}</p> <p className='countBox'>
{this.state.count + '/' + this.props.limitLength}
</p>
</div> </div>
) )
} }