diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 652a90258..725817d17 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -229,6 +229,15 @@ class ChoquesEditor extends Component{ var texts; const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; + + + + + if(this.isNull(_text)===true){ + + return + } + if (!reg.test(_text)) { // 处理编辑器内容为空 try { @@ -276,11 +285,28 @@ class ChoquesEditor extends Component{ toShowMode = () => { } + isNull=( str )=>{ + if ( str == "" ) return true; + var regu = "^[ ]+$"; + var re = new RegExp(regu); + //为空或纯空格为 true 有值为false + console.log(re.test(str)) + return re.test(str); + } onContentChange=(value,quill)=>{ // debugger const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; + + if(this.isNull(_text)===true){ + this.setState({ + question_titleysl:"" + }) + return + } + + if (!reg.test(_text)) { // 处理编辑器内容为空 try { @@ -304,6 +330,15 @@ class ChoquesEditor extends Component{ onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; + + + if(this.isNull(_text)===true){ + this.setState({ + question_titlesysl:"" + }) + return + } + if (!reg.test(_text)) { // 处理编辑器内容为空 try { diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index d7154259d..603fbd6e7 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -288,7 +288,15 @@ class JudquestionEditor extends Component{ }) } + isNull=( str )=>{ + if ( str == "" ) return true; + var regu = "^[ ]+$"; + var re = new RegExp(regu); + //为空或纯空格为 true 有值为false + console.log(re.test(str)) + return re.test(str); + } onContentChange=(value,quill)=>{ // console.log("这是题干赋值"); // console.log(value); @@ -297,6 +305,15 @@ class JudquestionEditor extends Component{ const reg = /^[\s\S]*.*[^\s][\s\S]*$/; // console.log(_text); // console.log(_text.length); + + + if(this.isNull(_text)===true){ + this.setState({ + question_titleysl:"" + }) + return + } + if (!reg.test(_text)) { // 处理编辑器内容为空 try { @@ -324,6 +341,14 @@ class JudquestionEditor extends Component{ onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; + + + if(this.isNull(_text)===true){ + this.setState({ + question_titlesysl:"" + }) + return + } if (!reg.test(_text)) { // 处理编辑器内容为空 try { diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 5bfda9f7a..464eb19e0 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -251,6 +251,11 @@ class SingleEditor extends Component{ var texts; const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; + + + if(this.isNull(_text)===true){ + return + } if (!reg.test(_text)) { // 处理编辑器内容为空 try { @@ -296,11 +301,30 @@ class SingleEditor extends Component{ toShowMode = () => { } + isNull=( str )=>{ + if ( str == "" ) return true; + var regu = "^[ ]+$"; + var re = new RegExp(regu); + //为空或纯空格为 true 有值为false + console.log(re.test(str)) + return re.test(str); + } onContentChange=(value,quill)=>{ var _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; + + + if(this.isNull(_text)===true){ + this.setState({ + question_titleysl:"" + }) + return + } + + + if (!reg.test(_text)) { // 处理编辑器内容为空 try { @@ -323,6 +347,12 @@ class SingleEditor extends Component{ onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; + if(this.isNull(_text)===true){ + this.setState({ + question_titlesysl:"" + }) + return + } if (!reg.test(_text)) { // 处理编辑器内容为空 try {