forked from DevCloudFE/vue-devui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.ts
88 lines (87 loc) · 2.66 KB
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
export function parseHTMLStringToDomList(html: string): NodeList | any[] {
const domParser = new DOMParser();
const htmlNode = domParser.parseFromString(html, 'text/html');
return htmlNode.querySelector('body') ? htmlNode.querySelector('body')?.childNodes || [] : [];
}
export function locale(key: string): string {
const localeMap: Record<any, string> = {
undo: '撤销',
redo: '重做',
clean: '清除格式',
header: '段落样式',
normal: '正文',
h1: '标题1',
h2: '标题2',
h3: '标题3',
h4: '标题4',
h5: '标题5',
h6: '标题6',
font: '字体',
size: '字号',
songti: '宋体',
yahei: '微软雅黑',
kaiti: '楷体',
heiti: '黑体',
lishu: '隶书',
bold: '粗体',
italic: '斜体',
underline: '下划线',
strike: '删除线',
color: '字体颜色',
background: '背景色',
orderedlist: '有序列表',
unorderedlist: '无序列表',
checklist: '任务列表',
left: '左对齐',
center: '居中',
right: '右对齐',
image: '图片',
file: '文件',
table: '表格',
link: '超链接',
code: '行内代码',
codeblock: '代码块',
blockquote: '引用',
superscript: '上标',
subscript: '下标',
globallink: '全局链接',
emoji: '表情',
fullscreen: '全屏',
'exit-fullscreen': '退出全屏',
help: '帮助',
more: '更多',
'help-format': '格式',
'help-insert': '插入',
'help-operation': '操作',
mention: '提及某人',
'quick-menu': '快捷菜单',
'toggle-help-panel': '打开/关闭帮助面板',
'scroll-table': '水平滚动表格',
'mouse-wheel': '鼠标滚轮',
save: '保存',
'copy-cells': '复制',
'copy-table': '复制表格',
'cut-cells': '剪切',
'empty-cells': '清空内容',
'insert-row-up': '上插入行',
'insert-row-down': '下插入行',
'insert-column-left': '左插入行',
'insert-column-right': '右插入行',
'merge-cells': '合并单元格',
'unmerge-cells': '拆分单元格',
'delete-row': '删除当前行',
'delete-column': '删除当前列',
'delete-table': '删除表格',
'default-link-text': '链接',
basicblock: '卡片',
linkplaceholder: '请输入链接地址,按回车确认',
'counter-template': '{{count}}/{{totalCount}}',
char: '字符',
word: '单词',
'counter-limit-tips': '{{countUnit}}数超出最大允许值',
'ie-msg': '为了更好体验,请使用chrome浏览器',
loading: '正在加载中...',
pasting: '您粘贴内容较多, 正在努力加载中,请耐心等待...',
};
return localeMap[key] || key;
}