修改题库可以输入空格

dev_aliyun2
杨树林 5 years ago committed by harry
parent fe626d5e1c
commit 31651d74ee

@ -219,22 +219,9 @@ 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 {
texts=JSON.stringify(value);
}catch (e) {
texts="";
}
} else {
if(_text.length>=500){
var result = _text.substring(0,450);
@ -288,66 +275,46 @@ class ChoquesEditor extends Component {
// debugger
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
// 提交到后台的内容需要处理一下;
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl: JSON.stringify(value)
question_titleysl:texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titleysl: texts
})
}
}
onContentChanges = (value, quill) => {
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
// 提交到后台的内容需要处理一下;
try {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl: JSON.stringify(value)
question_titlesysl:texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titlesysl: texts
})
}
}

@ -4,7 +4,6 @@ import { Radio } from 'antd';
import update from 'immutability-helper'
import './../questioncss/questioncom.css';
import '../questioncss/font.css';
import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
import QuillForEditor from '../../../common/quillForEditor';
const tagArray = [
@ -292,72 +291,50 @@ class JudquestionEditor extends Component {
// console.log(quill);
const _text = quill.getText();
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 {
this.setState({
question_titleysl:JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
// console.log("空");
} else {
// console.log("有");
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl: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)) {
// 处理编辑器内容为空
try {
this.setState({
question_titlesysl:JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
try {
texts = JSON.stringify(value);
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
}
}
render() {

@ -128,7 +128,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()
@ -232,6 +238,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;
@ -239,18 +246,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);
@ -303,81 +301,47 @@ class SingleEditor extends Component {
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} else {
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl: JSON.stringify(value)
question_titleysl:texts===undefined|| null?"":texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
} else {
var texts="";
if(_text.length>=979){
var result = _text.substring(0,975);
// console.log("11111111");
// console.log(result.length);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
// console.log("2222");
// 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_titleysl: texts
})
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
} 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) => {

@ -919,21 +919,21 @@ class NewHeader extends Component {
`
}
</style>
{/*{*/}
{/* Periofters===true?*/}
{/* <li className={`pr questionbanks`} >*/}
{/* <Popover className="queyppors" id={"yslpopovers"} placement="bottom" content={contents} trigger="click" >*/}
{/* <div className=" sortinxdirection mr10">*/}
{/* <div style={{*/}
{/* color:"#fff"*/}
{/* }}>*/}
{/* 题库*/}
{/* </div>*/}
{/* </div>*/}
{/* </Popover>*/}
{/* </li>*/}
{/* :""*/}
{/*}*/}
{
Periofters===true?
<li className={`pr questionbanks`} >
<Popover className="queyppors" id={"yslpopovers"} placement="bottom" content={contents} trigger="click" >
<div className=" sortinxdirection mr10">
<div style={{
color:"#fff"
}}>
题库
</div>
</div>
</Popover>
</li>
:""
}
<li

Loading…
Cancel
Save