Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
2728a216
Commit
2728a216
authored
May 18, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:从word复制新建题目样式过滤
parent
7b526754
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
src/modules/teach-tool/question-manage/components/QuestionEditor.jsx
+2
-1
src/modules/teach-tool/question-manage/components/QuestionList.jsx
+13
-3
No files found.
src/modules/teach-tool/question-manage/components/QuestionEditor.jsx
View file @
2728a216
...
...
@@ -129,6 +129,7 @@ class QuestionEditor extends Component {
var
str1
=
content
;
// 所有特殊字符
str1
=
str1
.
replace
(
/<xml>
[\s\S]
*
?
<
\/
xml>/gi
,
""
);
str1
=
str1
.
replace
(
/<style>
[\s\S]
*
?
<
\/
style>/gi
,
""
);
str1
=
str1
.
replace
(
/style
\s
*
?
=
\s
*
?([
‘"
])[\s\S]
*
?\1
/gi
,
""
);
str1
=
str1
.
replace
(
/<
\/?[^
>
]
*>/g
,
""
);
str1
=
str1
.
replace
(
/
[
|
]
*
\n
/g
,
"
\
n"
);
str1
=
str1
.
replace
(
/
\&
nbsp
\;
/gi
,
" "
);
...
...
@@ -136,7 +137,7 @@ class QuestionEditor extends Component {
var
str2
=
content
;
// 保留空格和换行的其他字符
str2
=
str2
.
replace
(
/<xml>
[\s\S]
*
?
<
\/
xml>/gi
,
""
);
str2
=
str2
.
replace
(
/<style>
[\s\S]
*
?
<
\/
style>/gi
,
""
);
str2
=
str2
.
replace
(
/
<
(?!
br
)
.*
?
>/g
,
""
);
str2
=
str2
.
replace
(
/
style
\s
*
?
=
\s
*
?([
‘"
])[\s\S]
*
?\1
/gi
,
""
);
if
(
editorRoot
.
txt
.
text
().
length
+
str1
.
length
>
1000
)
{
content
=
str2
.
substring
(
0
,
1000
);
message
.
error
(
"内容过长,不能超过1000字"
);
...
...
src/modules/teach-tool/question-manage/components/QuestionList.jsx
View file @
2728a216
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-0
4-12 14:14:19
* @LastEditTime: 2021-0
5-18 15:25:40
* @Description: 助学工具-题库-题目列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -225,16 +225,26 @@ class QuestionList extends Component {
handleVal
=
handleVal
.
replace
(
/<
(?!
img|input
)
.*
?
>/g
,
""
);
handleVal
=
handleVal
.
replace
(
/<
\s?
input
[^
>
]
*>/gi
,
"_、"
);
handleVal
=
handleVal
.
replace
(
/
\&
nbsp
\;
/gi
,
" "
);
handleVal
=
handleVal
.
replace
(
/style
\s
*
?
=
\s
*
?([
‘"
])[\s\S]
*
?\1
/gi
,
""
);
return
(
<
Tooltip
overlayClassName=
"aid-tool-list"
title=
{
<
div
style=
{
{
maxWidth
:
700
,
width
:
"auto"
}
}
>
{
handleVal
}
</
div
>
<
div
style=
{
{
maxWidth
:
700
,
width
:
"auto"
}
}
dangerouslySetInnerHTML=
{
{
__html
:
handleVal
,
}
}
/>
}
placement=
"topLeft"
overlayStyle=
{
{
maxWidth
:
700
}
}
>
{
handleVal
}
<
div
dangerouslySetInnerHTML=
{
{
__html
:
handleVal
,
}
}
/>
</
Tooltip
>
);
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment