@lambo-design/wang-editor 2.0.0-beta.6 → 2.0.0-beta.7
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 +5 -4
- package/src/index.vue +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/wang-editor",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
"registry": "https://registry.npmjs.org/"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@lambo-design/
|
|
14
|
-
"@lambo-design/
|
|
13
|
+
"@lambo-design/core": "^4.7.1-beta.183",
|
|
14
|
+
"@lambo-design/shared": "^1.0.0-beta.379"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@wangeditor/editor": "5.1.23",
|
|
18
|
-
"@wangeditor/editor-for-vue": "^1.0.2"
|
|
18
|
+
"@wangeditor/editor-for-vue": "^1.0.2",
|
|
19
|
+
"xss": "^1.0.15"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
package/src/index.vue
CHANGED
|
@@ -24,6 +24,7 @@ import {oneOf} from '@lambo-design/shared/utils/platform';
|
|
|
24
24
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
|
25
25
|
import '@wangeditor/editor/dist/css/style.css'
|
|
26
26
|
|
|
27
|
+
import xss from 'xss';
|
|
27
28
|
export default {
|
|
28
29
|
name: 'LamboWangEditor',
|
|
29
30
|
components: { Editor, Toolbar },
|
|
@@ -153,13 +154,14 @@ export default {
|
|
|
153
154
|
},
|
|
154
155
|
methods: {
|
|
155
156
|
setHtml(val) {
|
|
157
|
+
let htmlVal = xss(val)
|
|
156
158
|
if (this.editor) {
|
|
157
|
-
this.editor.setHtml(
|
|
159
|
+
this.editor.setHtml(htmlVal)
|
|
158
160
|
} else {
|
|
159
161
|
// 编辑器尚未初始化时的处理
|
|
160
162
|
console.warn('Editor not initialized yet, queuing the content update...');
|
|
161
163
|
// 可以考虑缓存内容,等待编辑器初始化后设置
|
|
162
|
-
this.pendingContent =
|
|
164
|
+
this.pendingContent = htmlVal;
|
|
163
165
|
}
|
|
164
166
|
},
|
|
165
167
|
handleChange(editor) {
|