Skip to content

Commit de8d758

Browse files
authored
Merge pull request #1930 from DevCloudFE/dev
feat(md): a标签可允许更多协议类型
2 parents 67452e9 + 74389bf commit de8d758

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/devui-vue/devui/editor-md/src/composables/md-render-service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@ export class MDRenderService {
102102
}
103103

104104
private onIgnoreTagAttr(tag: string, name: string, value: string, isWhiteAttr: boolean) {
105-
if (!isWhiteAttr && (name === 'id' || (tag === 'span' && name === 'style'))) {
105+
if (!isWhiteAttr && (name === 'id' || (tag === 'span' && name === 'style')
106+
|| (tag === 'a' && name === 'href'))) {
107+
return name + '=' + value;
108+
}
109+
}
110+
111+
private onTagAttr(tag: string, name: string, value: string, isWhiteAttr: boolean) {
112+
if (isWhiteAttr && (tag === 'a' && name === 'href')) {
106113
return name + '=' + value;
107114
}
108115
}
@@ -139,6 +146,7 @@ export class MDRenderService {
139146
html = filterXSS(html, {
140147
whiteList: this.xssWhiteList,
141148
onIgnoreTagAttr: this.onIgnoreTagAttr,
149+
onTagAttr: this.onTagAttr,
142150
css: {
143151
whiteList: Object.assign({}, this.cssWhiteList, {
144152
top: true,

packages/devui-vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-devui",
3-
"version": "1.6.29",
3+
"version": "1.6.30",
44
"license": "MIT",
55
"description": "DevUI components based on Vite and Vue3",
66
"keywords": [

0 commit comments

Comments
 (0)