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
52c18217
Commit
52c18217
authored
Jul 12, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:编辑器字数统计方法修改
parent
d975046f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
15 deletions
+10
-15
src/modules/course-manage/components/GraphicsEditor.jsx
+10
-15
No files found.
src/modules/course-manage/components/GraphicsEditor.jsx
View file @
52c18217
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-07-05 10:47:19
* @LastEditors: yuananting
* @LastEditTime: 2021-07-12 17:
05:59
* @LastEditTime: 2021-07-12 17:
13:38
* @Description: 描述一下咯
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
...
...
@@ -139,22 +139,17 @@ class GraphicsEditor extends React.Component {
return
str
;
};
this
.
editorInt
.
config
.
onchange
=
(
html
)
=>
{
var
str1
=
html
;
// 去除所有特殊字符
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
,
''
);
str1
=
str1
.
replace
(
/<
\/?
a.*
?
>/g
,
''
);
var
str2
=
html
;
// 保留空格和换行的其他字符
str2
=
str2
.
replace
(
/<xml>
[\s\S]
*
?
<
\/
xml>/gi
,
''
);
str2
=
str2
.
replace
(
/<style>
[\s\S]
*
?
<
\/
style>/gi
,
''
);
str2
=
str2
.
replace
(
/<
\/?
a.*
?
>/g
,
''
);
var
str
=
this
.
editorInt
.
txt
.
text
();
// 去除所有特殊字符
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
,
''
);
str
=
str
.
replace
(
/<
\/?
a.*
?
>/g
,
''
);
const
videoCount
=
((
html
||
''
).
match
(
/<iframe/g
)
||
[]).
length
;
const
imageCount
=
((
html
||
''
).
match
(
/<img/g
)
||
[]).
length
;
const
textLength
=
str
1
.
length
+
videoCount
+
imageCount
;
const
textLength
=
str
.
length
+
videoCount
+
imageCount
;
this
.
setState
({
textLength
},
()
=>
{
if
(
textLength
>
maxLimit
)
{
message
.
warning
(
`内容过长,不能超过
${
maxLimit
}
字`
);
...
...
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