Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update from dev #1775

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading