|
@@ -60,6 +60,21 @@ class Wangedit extends React.Component {
|
60
|
60
|
'undo', // 撤销
|
61
|
61
|
'redo' // 重复
|
62
|
62
|
]
|
|
63
|
+
|
|
64
|
+ // 过滤 word 字符
|
|
65
|
+ this.editor.customConfig.pasteFilterStyle = false
|
|
66
|
+ this.editor.customConfig.pasteTextHandle = function(content) {
|
|
67
|
+ const regs = [
|
|
68
|
+ /<!--\[if [\s\S]*?endif\]-->/ig,
|
|
69
|
+ /<[a-zA-Z0-9]+\:[^>]+>[^>]*<\/[a-zA-Z0-9]+\:[^>]+>/ig,
|
|
70
|
+ /<[a-zA-Z0-9]+\:[^>]+\/>/ig,
|
|
71
|
+ /<style>[\s\S]*?<\/style>/ig,
|
|
72
|
+ ]
|
|
73
|
+
|
|
74
|
+ return regs.reduce((acc, reg) => {
|
|
75
|
+ return acc.replace(reg, '')
|
|
76
|
+ }, content)
|
|
77
|
+ }
|
63
|
78
|
|
64
|
79
|
this.editor.create()
|
65
|
80
|
this.editor.customConfig.uploadImgShowBase64 = true
|