Commit 93fd7ffe by yuananting

fix:题库题目信息样式保留

parent 4d5bed0d
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-29 10:52:26
* @LastEditors: yuananting
* @LastEditTime: 2021-04-07 15:23:06
* @LastEditTime: 2021-05-08 16:11:27
* @Description: 助学工具-试卷-新建选择题目弹窗
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -35,6 +35,7 @@ class SelectQuestionModal extends Component {
return (
<Modal
className="select-question-modal"
maskClosable={false}
destroyOnClose={true}
title="选择题目"
visible={true}
......
......@@ -126,18 +126,24 @@ class QuestionEditor extends Component {
// 自定义处理粘贴的文本内容
editorRoot.config.pasteTextHandle = function (content) {
if (content == "" && !content) return "";
var str = content;
str = str.replace(/<xml>[\s\S]*?<\/xml>/gi, "");
str = str.replace(/<style>[\s\S]*?<\/style>/gi, "");
str = str.replace(/<\/?[^>]*>/g, "");
str = str.replace(/[ | ]*\n/g, "\n");
str = str.replace(/\&nbsp\;/gi, " ");
str = str.replace(/[\r\n]/g, "");
if (str.length > 1000) {
str = str.substring(0, 1000);
var str1 = content; // 所有特殊字符
str1 = str1.replace(/<xml>[\s\S]*?<\/xml>/gi, "");
str1 = str1.replace(/<style>[\s\S]*?<\/style>/gi, "");
str1 = str1.replace(/<\/?[^>]*>/g, "");
str1 = str1.replace(/[ | ]*\n/g, "\n");
str1 = str1.replace(/\&nbsp\;/gi, " ");
str1 = str1.replace(/[\r\n]/g, "");
var str2 = content; // 保留空格和换行的其他字符
str2 = str2.replace(/<xml>[\s\S]*?<\/xml>/gi, "");
str2 = str2.replace(/<style>[\s\S]*?<\/style>/gi, "");
str2 = str2.replace(/<(?!br).*?>/g, "");
if (editorRoot.txt.text().length + str1.length > 1000) {
content = str2.substring(0, 1000);
message.error("内容过长,不能超过1000字");
} else {
content = str2;
}
return str;
return content;
};
let prevList = [];
......
......@@ -41,7 +41,7 @@
.editor-box_content {
width: calc(100% - 80px);
p {
display: inline-block;
display: inline;
}
}
.editor-limit {
......@@ -60,7 +60,7 @@
max-height: 110px;
overflow: auto;
p {
display: inline-block;
display: inline;
overflow-y: scroll;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment