Skip to content

Commit

Permalink
Merge pull request #1759 from DevCloudFE/dev
Browse files Browse the repository at this point in the history
Chore: Update main from dev (release: 1.6.0)
  • Loading branch information
GreatZPP authored Oct 23, 2023
2 parents 5431262 + 3a2b3f2 commit 537dafe
Show file tree
Hide file tree
Showing 33 changed files with 1,312 additions and 409 deletions.
9 changes: 1 addition & 8 deletions packages/devui-vue/devui-cli/shared/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,45 @@ exports.VITEPRESS_SIDEBAR_FILE_EN = resolve(
`config/${this.VITEPRESS_SIDEBAR_FILE_NAME_EN}`
);
// 这里的分类顺序将会影响最终生成的页面侧边栏顺序
exports.VITEPRESS_SIDEBAR_CATEGORY = ['通用', 'DesignToken', '导航', '反馈', '数据录入', '数据展示', '布局', '演进中'];
exports.VITEPRESS_SIDEBAR_CATEGORY = ['通用', '导航', '反馈', '数据录入', '数据展示', '布局', '演进中'];
exports.DESIGN_TOKENS_INFO = [
{
category: 'DesignToken',
text: 'Animation 动效',
status: '100%',
name: 'design-animation',
link: "/components/design-animation/",
},
{
category: 'DesignToken',
text: 'BorderRadius 圆角',
status: '100%',
name: 'design-radius',
link: "/components/design-radius/",
},
{
category: 'DesignToken',
text: 'Color 颜色',
status: '100%',
name: 'design-color',
link: "/components/design-color/",
},
{
category: 'DesignToken',
text: 'Font 字体',
status: '100%',
name: 'design-font',
link: "/components/design-font/",
},
{
category: 'DesignToken',
text: 'Link 链接',
status: '100%',
name: 'design-link',
link: "/components/design-link/",
},
{
category: 'DesignToken',
text: 'Shadow 阴影',
status: '100%',
name: 'design-shadow',
link: "/components/design-shadow/",
},
{
category: 'DesignToken',
text: 'ZIndex 层级',
status: '100%',
name: 'design-zindex',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as hljs from 'highlight.js';
import hljs from 'highlight.js';
import MarkdownIt from 'markdown-it';
import { filterXSS, getDefaultCSSWhiteList, getDefaultWhiteList, IWhiteList } from 'xss';
import { mermaidRender, refreshMermaid } from '../plugins/mermaid';
Expand All @@ -15,21 +15,23 @@ export class MDRenderService {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(str, { language: lang }).value;
} catch (_) { }
} catch (_) {}
}
return '';
}
},
}) as any;
private baseUrl = '';
private breaks = true;
private renderParse: Function | undefined;

constructor() {
this.setDefaultXss();
this.mdt.use(tocAndAnchor, {
linkify: false,
anchorLink: false
}).use(mermaidRender, { id: 'devui-mermaid' });
this.mdt
.use(tocAndAnchor, {
linkify: false,
anchorLink: false,
})
.use(mermaidRender, { id: 'devui-mermaid' });
}

private setDefaultXss() {
Expand All @@ -46,7 +48,6 @@ export class MDRenderService {
this.xssWhiteList['path'] = ['style', 'class', 'd', 'id', 'fill', 'stroke'];
this.xssWhiteList['th'] = ['style'];
this.xssWhiteList['td'] = ['style'];

}

setBaseUrl(url: string) {
Expand All @@ -71,15 +72,15 @@ export class MDRenderService {

setCustomXssRules(rules: ICustomXssRule[]) {
if (rules) {
rules.forEach(rule => {
rules.forEach((rule) => {
this.xssWhiteList[rule['key']] = rule['value'];
});
}
}

setCustomRendererRules(rules: ICustomRenderRule[]) {
if (rules) {
rules.forEach(rule => {
rules.forEach((rule) => {
this.mdt.renderer.rules[rule['key']] = rule['value'];
});
}
Expand All @@ -90,7 +91,7 @@ export class MDRenderService {
}

setPlugins(plugins: Array<MdPlugin>) {
plugins.forEach(item => {
plugins.forEach((item) => {
const { plugin, opts } = item;
this.mdt.use(plugin, opts);
});
Expand Down Expand Up @@ -139,7 +140,7 @@ export class MDRenderService {
top: true,
left: true,
bottom: true,
right: true
right: true,
}),
},
});
Expand All @@ -153,7 +154,7 @@ export class MDRenderService {

public setRules(mdRules: Record<string, any>): void {
if (mdRules) {
Object.keys(mdRules).forEach(rule => {
Object.keys(mdRules).forEach((rule) => {
this.mdt[rule].set(mdRules[rule]);
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/devui-vue/devui/editor-md/src/toolbar-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ class ToolBarHandler {
const selection = editor.getSelection();
editor.focus();
if (selection === '') {
editor.replaceSelection('- [ ] ' + selection);
editor.replaceSelection('[ ] ' + selection);
} else {
const selectionText = selection.split('\n');

for (let i = 0, len = selectionText.length; i < len; i++) {
selectionText[i] = selectionText[i] === '' ? '' : '- [ ] ' + selectionText[i];
selectionText[i] = selectionText[i] === '' ? '' : '[ ] ' + selectionText[i];
}

editor.replaceSelection(selectionText.join('\n'));
Expand Down
6 changes: 3 additions & 3 deletions packages/devui-vue/docs/.vitepress/demo/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export default {
.demo-block {
margin: 10px 0;
border: solid 1px #ebebeb;
border-radius: 3px;
border-radius: 20px;
transition: 0.2s;
}
Expand Down Expand Up @@ -249,8 +249,8 @@ export default {
height: 44px;
box-sizing: border-box;
background-color: #fff;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
text-align: center;
margin-top: -1px;
color: #d3dce6;
Expand Down
Loading

0 comments on commit 537dafe

Please sign in to comment.