diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 6b1bbd07e..5e04a742a 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -226,24 +226,23 @@ class ChoquesEditor extends Component { texts=""; } } else { - // if(_text.length>=500){ - // var result = _text.substring(0,450); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else { - // // 提交到后台的内容需要处理一下; - // value = JSON.stringify(value); - // if(value.length>=500){ - // let a=value.length-500; - // let b=_text.length-a; - // var result = _text.substring(0,b); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else{ - // texts=value; - // } - // } - texts = JSON.stringify(value); + if(_text.length>=500){ + var result = _text.substring(0,450); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else { + // 提交到后台的内容需要处理一下; + value = JSON.stringify(value); + if(value.length>=500){ + let a=value.length-500; + let b=_text.length-a; + var result = _text.substring(0,b); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else{ + texts=value; + } + } } let question_choices = this.state.question_choices.slice(0); question_choices[index] = texts; @@ -285,24 +284,6 @@ class ChoquesEditor extends Component { } else { // 提交到后台的内容需要处理一下; let texts=""; - // if(_text.length>=979){ - // var result = _text.substring(0,975); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // console.log("111111111"); - // console.log(texts.length); - // }else { - // value = JSON.stringify(value); - // if(value.length>=1000){ - // let a=value.length-1000; - // let b=_text.length-a; - // var result = _text.substring(0,b); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else{ - // texts=value; - // } - // } texts = JSON.stringify(value); this.setState({ question_titleysl: texts @@ -326,24 +307,7 @@ class ChoquesEditor extends Component { } else { // 提交到后台的内容需要处理一下; let texts=""; - // if(_text.length>=979){ - // var result = _text.substring(0,975); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // console.log("2222222"); - // console.log(texts.length); - // }else { - // value = JSON.stringify(value); - // if(value.length>=1000){ - // let a=value.length-1000; - // let b=_text.length-a; - // var result = _text.substring(0,b); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else{ - // texts=value; - // } - // } + texts = JSON.stringify(value); this.setState({ question_titlesysl: texts diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index f9dfaf21b..7b3ab87f7 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -302,22 +302,6 @@ class JudquestionEditor extends Component { // 提交到后台的内容需要处理一下; let texts=""; - // if(_text.length>=979){ - // var result = _text.substring(0,975); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else { - // value = JSON.stringify(value); - // if(value.length>=1000){ - // let a=value.length-1000; - // let b=_text.length-a; - // var result = _text.substring(0,b); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else{ - // texts=value; - // } - // } texts = JSON.stringify(value); this.setState({ question_titleysl: texts @@ -342,22 +326,7 @@ class JudquestionEditor extends Component { } else { // 提交到后台的内容需要处理一下; let texts=""; - // if(_text.length>=979){ - // var result = _text.substring(0,975); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else { - // value = JSON.stringify(value); - // if(value.length>=1000){ - // let a=value.length-1000; - // let b=_text.length-a; - // var result = _text.substring(0,b); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else{ - // texts=value; - // } - // } + texts = JSON.stringify(value); this.setState({ question_titlesysl: texts diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index fbe624625..3b4a99f6d 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -247,26 +247,24 @@ class SingleEditor extends Component { texts=""; } } else { - // if(_text.length>=500){ - // var result = _text.substring(0,450); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else { - // // 提交到后台的内容需要处理一下; - // - // if(value.length>=500){ - // let a=value.length-500; - // let b=_text.length-a; - // var result = _text.substring(0,b); - // texts={"ops":[{"insert":result}]}; - // texts=JSON.stringify(texts); - // }else{ - // texts=value; - // } - // } - texts = JSON.stringify(value); + if(_text.length>=500){ + var result = _text.substring(0,450); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else { + // 提交到后台的内容需要处理一下; + value = JSON.stringify(value); + if(value.length>=500){ + let a=value.length-500; + let b=_text.length-a; + var result = _text.substring(0,b); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else{ + texts=value; + } + } } - let question_choices = this.state.question_choices.slice(0); question_choices[index] = texts; this.setState({ question_choices }); @@ -346,27 +344,6 @@ class SingleEditor extends Component { }) } } else { - var texts=""; - if(_text.length>=979){ - var result = _text.substring(0,975); - // console.log("33333333"); - // console.log(result.length); - texts={"ops":[{"insert":result}]}; - texts=JSON.stringify(texts); - // ; console.log("44444444"); - // console.log(texts.length) - }else { - value = JSON.stringify(value); - if(value.length>=1000){ - let a=value.length-1000; - let b=_text.length-a; - var result = _text.substring(0,b); - texts={"ops":[{"insert":result}]}; - texts=JSON.stringify(texts); - }else{ - texts=value; - } - } let texts = JSON.stringify(value); this.setState({ question_titlesysl: texts