富文本限制一千字

This commit is contained in:
red-deng-deng 2022-01-22 12:02:26 +08:00
parent 458ac69a76
commit 8dc11c1311
2 changed files with 4 additions and 4 deletions

View File

@ -38,8 +38,8 @@ export default class wangeditor extends React.Component{
if(text.length==0){//没有文字 if(text.length==0){//没有文字
self.props.setEdittext(""); self.props.setEdittext("");
} }
if(text.length>10){ if(text.length>1000){
let str = text.slice(0,10); let str = text.slice(0,1000);
self.setState({editorHtml:str}); self.setState({editorHtml:str});
editor.txt.html(str) editor.txt.html(str)
self.props.setEdittext(str); self.props.setEdittext(str);

View File

@ -35,8 +35,8 @@ export default class wangeditor extends React.Component{
if(text.length==0){//没有文字 if(text.length==0){//没有文字
self.props.setEdittext(""); self.props.setEdittext("");
} }
if(text.length>10){ if(text.length>1000){
let str = text.slice(0,10); let str = text.slice(0,1000);
self.setState({editorHtml:str}); self.setState({editorHtml:str});
editor.txt.html(str) editor.txt.html(str)
self.props.setEdittext(str); self.props.setEdittext(str);