Skip to content

Commit

Permalink
Merge pull request #1775 from DevCloudFE/dev
Browse files Browse the repository at this point in the history
chore: update from dev
  • Loading branch information
GreatZPP authored Jan 3, 2024
2 parents 537dafe + c767cfb commit 7054ce2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/devui-vue/devui/button/src/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $devui-btn-lg-padding: var(--devui-btn-lg-padding, 0 24px);
.#{$devui-prefix}-button {
padding: $devui-btn-padding;
font-size: $devui-font-size-md;
height: $devui-size-md;
line-height: $devui-line-height-base;
border-radius: $devui-border-radius;
border-width: 1px;
Expand Down
4 changes: 2 additions & 2 deletions packages/devui-vue/devui/editor-md/src/plugins/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export default function (md: any, options: Record<string, any>) {
let content;
if (heading.children && heading.children.length > 0 && heading.children[0].type === 'link_open') {
content = heading.children[1].content;
heading._toAnchor = safeString(content);
heading._tocAnchor = safeString(content);
} else {
content = heading.content;
heading._toAnchor = safeString(heading.children.reduce((s, t) => s + t.content, ''));
heading._tocAnchor = safeString(heading.children.reduce((s, t) => s + t.content, ''));
}
headings.push({
content,
Expand Down
14 changes: 10 additions & 4 deletions packages/devui-vue/docs/components/editor-md/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,25 @@ export default defineComponent({

### 自定义渲染

:::demo 自定义从 md 到 html 的渲染规则。
:::demo 自定义从 md 到 html 的渲染规则,也可自定义XSS过滤规则,放开指定标签

```vue
<template>
<d-editor-md v-model="content" :custom-renderer-rules="customRendererRules"></d-editor-md>
<d-editor-md v-model="content" :custom-renderer-rules="customRendererRules" :custom-xss-rules="customRenderRules"></d-editor-md>
</template>
<script>
import { defineComponent, ref } from 'vue';
export default defineComponent({
setup() {
const content = ref('[link](#test)');
const content = ref('[link](#test)\n<kbd>kbd 标签渲染</kbd>');
const customRenderRules = ref([
{
key: 'kbd',
value: [], // 为空表示过滤所有属性,放开属性则添加对应项,如['id', 'style']
},
])
const customRendererRules = ref([
{
key: 'link_open',
Expand All @@ -69,7 +75,7 @@ export default defineComponent({
},
},
]);
return { content, customRendererRules };
return { content, customRendererRules, customRenderRules };
},
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-devui",
"version": "1.6.0",
"version": "1.6.1",
"license": "MIT",
"description": "DevUI components based on Vite and Vue3",
"keywords": [
Expand Down

0 comments on commit 7054ce2

Please sign in to comment.