|
|
|
@ -140,7 +140,13 @@ class SingleEditor extends Component{
|
|
|
|
|
// this.refs['titleEditor'].showError()
|
|
|
|
|
this.props.showNotification('请您输入题干');
|
|
|
|
|
return editordata;
|
|
|
|
|
}else{
|
|
|
|
|
console.log("question_titleysl");
|
|
|
|
|
console.log(question_titleysl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i < question_choices.length; i++) {
|
|
|
|
|
if (!question_choices[i]) {
|
|
|
|
|
// this.refs[`optionEditor${i}`].showError()
|
|
|
|
@ -244,6 +250,7 @@ class SingleEditor extends Component{
|
|
|
|
|
this.setState({ standard_answers })
|
|
|
|
|
}
|
|
|
|
|
onOptionContentChange = (value,quill,index) => {
|
|
|
|
|
debugger
|
|
|
|
|
if (index >= this.state.question_choices.length) {
|
|
|
|
|
// TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3
|
|
|
|
|
return;
|
|
|
|
@ -251,18 +258,9 @@ 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 {
|
|
|
|
|
texts= JSON.stringify(value)
|
|
|
|
|
}catch (e) {
|
|
|
|
|
texts="";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if(_text.length>=500){
|
|
|
|
|
var result = _text.substring(0,450);
|
|
|
|
@ -315,61 +313,47 @@ class SingleEditor extends Component{
|
|
|
|
|
|
|
|
|
|
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.isNull(_text)===true){
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:""
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!reg.test(_text)) {
|
|
|
|
|
// 处理编辑器内容为空
|
|
|
|
|
try {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl: JSON.stringify(value)
|
|
|
|
|
})
|
|
|
|
|
}catch (e) {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:""
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
let texts = JSON.stringify(value);
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:texts
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:texts===undefined|| null?"":texts
|
|
|
|
|
})
|
|
|
|
|
}catch (e) {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:""
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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)) {
|
|
|
|
|
// 处理编辑器内容为空
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:""
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
let texts = JSON.stringify(value);
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:JSON.stringify(value)
|
|
|
|
|
question_titlesysl:texts===undefined|| null?"":texts
|
|
|
|
|
})
|
|
|
|
|
}catch (e) {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:""
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
let texts = JSON.stringify(value);
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:texts
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
handleShowImage = (url) => {
|
|
|
|
|