@2kog/pkg-editor 0.0.3 → 0.0.4
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/assets/js/xss.js +1 -1
- package/src/components/Article.vue +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2kog/pkg-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Custom Tinymce、Article Renderer",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "npm run dev",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
},
|
|
63
63
|
"repository": {
|
|
64
64
|
"type": "git",
|
|
65
|
-
"url": "git+https://github.com/
|
|
65
|
+
"url": "git+https://github.com/RX-PLANET/pkg-editor.git"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/assets/js/xss.js
CHANGED
|
@@ -33,7 +33,7 @@ export default function sanitizeRichText(html) {
|
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
allowedSchemes: ["http", "https", "mailto", "tel"],
|
|
36
|
-
allowProtocolRelative:
|
|
36
|
+
allowProtocolRelative: true,
|
|
37
37
|
allowedSchemesByTag: { img: ["http", "https", "data"],iframe: ["http", "https"], },
|
|
38
38
|
|
|
39
39
|
transformTags: {
|
|
@@ -125,11 +125,18 @@ export default {
|
|
|
125
125
|
methods: {
|
|
126
126
|
doReg: function (data) {
|
|
127
127
|
if (data) {
|
|
128
|
-
//
|
|
129
|
-
data = execLazyload(data, this.cdnDomain);
|
|
130
|
-
data = execFilterIframe(data, this.iframeWhitelist);
|
|
128
|
+
// 1. 先执行 XSS 过滤(xss.js 已包含所有配置)
|
|
131
129
|
data = execFilterXSS(data);
|
|
130
|
+
|
|
131
|
+
// 2. 然后执行 iframe 白名单过滤
|
|
132
|
+
data = execFilterIframe(data, this.iframeWhitelist);
|
|
133
|
+
|
|
134
|
+
// 3. 处理图片懒加载
|
|
135
|
+
data = execLazyload(data, this.cdnDomain);
|
|
136
|
+
|
|
137
|
+
// 4. 最后处理链接
|
|
132
138
|
data = execFilterLink(data, this.linkWhitelist, this.linkStrict);
|
|
139
|
+
|
|
133
140
|
return data;
|
|
134
141
|
} else {
|
|
135
142
|
return "";
|