@lambo-design/wang-editor 1.0.0-beta.10 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.vue +21 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/wang-editor",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@lambo-design/core": "^4.7.1-beta.167",
|
|
17
|
-
"@lambo-design/shared": "^1.0.0-beta.
|
|
17
|
+
"@lambo-design/shared": "^1.0.0-beta.285"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
package/src/index.vue
CHANGED
|
@@ -67,6 +67,13 @@ export default {
|
|
|
67
67
|
type: String,
|
|
68
68
|
default: "/oss/file/get/"
|
|
69
69
|
},
|
|
70
|
+
/**
|
|
71
|
+
* @description 是否保留粘贴内容的样式
|
|
72
|
+
*/
|
|
73
|
+
preservePasteStyle: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
70
77
|
|
|
71
78
|
},
|
|
72
79
|
watch: {
|
|
@@ -103,8 +110,8 @@ export default {
|
|
|
103
110
|
this.$emit('on-change', html, text)
|
|
104
111
|
}
|
|
105
112
|
|
|
106
|
-
//
|
|
107
|
-
self.editor.customConfig.pasteFilterStyle =
|
|
113
|
+
// 根据 preservePasteStyle 属性决定是否保留粘贴样式
|
|
114
|
+
self.editor.customConfig.pasteFilterStyle = this.preservePasteStyle
|
|
108
115
|
// 设置触发事件间隔
|
|
109
116
|
self.editor.customConfig.onchangeTimeout = this.changeInterval
|
|
110
117
|
|
|
@@ -184,16 +191,18 @@ export default {
|
|
|
184
191
|
'#f9963b',
|
|
185
192
|
'#ffffff'
|
|
186
193
|
]
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
if (!this.preservePasteStyle) {
|
|
195
|
+
self.editor.customConfig.pasteTextHandle = function (content) {
|
|
196
|
+
// content 即粘贴过来的内容(html 或 纯文本),可进行自定义处理然后返回
|
|
197
|
+
if (content == '' && !content) return ''
|
|
198
|
+
var str = content
|
|
199
|
+
str = str.replace(/<xml>[\s\S]*?<\/xml>/ig, '')
|
|
200
|
+
str = str.replace(/<style>[\s\S]*?<\/style>/ig, '')
|
|
201
|
+
str = str.replace(/<\/?[^>]*>/g, '')
|
|
202
|
+
str = str.replace(/[ | ]*\n/g, '\n')
|
|
203
|
+
// str = str.replace(/ /ig, '')
|
|
204
|
+
return str
|
|
205
|
+
}
|
|
197
206
|
}
|
|
198
207
|
|
|
199
208
|
// create这个方法一定要在所有配置项之后调用
|