md-editor-v3 4.12.0 → 4.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/DropdownToolbar.cjs +3 -1
- package/lib/cjs/MdCatalog.cjs +270 -1
- package/lib/cjs/MdEditor.cjs +3101 -58
- package/lib/cjs/MdModal.cjs +3 -1
- package/lib/cjs/MdPreview.cjs +3 -1
- package/lib/cjs/ModalToolbar.cjs +124 -1
- package/lib/cjs/NormalToolbar.cjs +61 -1
- package/lib/cjs/chunks/config.cjs +290 -1
- package/lib/cjs/chunks/dom.cjs +64 -1
- package/lib/cjs/chunks/index.cjs +1863 -8
- package/lib/cjs/chunks/index2.cjs +198 -1
- package/lib/cjs/chunks/index3.cjs +270 -1
- package/lib/cjs/chunks/index4.cjs +141 -2
- package/lib/cjs/chunks/vue-tsx.cjs +10 -1
- package/lib/cjs/config.cjs +12 -1
- package/lib/cjs/index.cjs +25 -1
- package/lib/es/DropdownToolbar.mjs +2 -2
- package/lib/es/MdCatalog.mjs +164 -114
- package/lib/es/MdEditor.mjs +2292 -1677
- package/lib/es/MdModal.mjs +2 -2
- package/lib/es/MdPreview.mjs +2 -2
- package/lib/es/ModalToolbar.mjs +55 -38
- package/lib/es/NormalToolbar.mjs +26 -18
- package/lib/es/chunks/config.mjs +73 -54
- package/lib/es/chunks/dom.mjs +57 -24
- package/lib/es/chunks/index.mjs +1093 -611
- package/lib/es/chunks/index2.mjs +126 -78
- package/lib/es/chunks/index3.mjs +185 -111
- package/lib/es/chunks/index4.mjs +124 -73
- package/lib/es/chunks/vue-tsx.mjs +8 -8
- package/lib/es/config.mjs +11 -10
- package/lib/es/index.mjs +23 -23
- package/lib/preview.css +200 -1
- package/lib/style.css +592 -1
- package/lib/types/DropdownToolbar/DropdownToolbar.d.ts +1 -1
- package/lib/types/DropdownToolbar/index.d.ts +39 -61
- package/lib/types/MdCatalog/CatalogLink.d.ts +1 -1
- package/lib/types/MdCatalog/MdCatalog.d.ts +1 -1
- package/lib/types/MdCatalog/index.d.ts +47 -60
- package/lib/types/MdEditor/Editor.d.ts +1 -1
- package/lib/types/MdEditor/components/Checkbox/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Divider/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Dropdown/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Icon/Icon.d.ts +1 -1
- package/lib/types/MdEditor/components/Icon/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +2 -2
- package/lib/types/MdEditor/components/Modal/index.d.ts +59 -63
- package/lib/types/MdEditor/components/Popper/index.d.ts +1 -1
- package/lib/types/MdEditor/index.d.ts +238 -104
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Content/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/MarkdownTotal.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/ScrollAuto.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/Clip.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/Link.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Toolbar/TableShape.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +1 -1
- package/lib/types/MdEditor/utils/vue-tsx.d.ts +1 -1
- package/lib/types/MdPreview/MdPreview.d.ts +1 -1
- package/lib/types/MdPreview/index.d.ts +119 -73
- package/lib/types/ModalToolbar/ModalToolbar.d.ts +1 -1
- package/lib/types/ModalToolbar/index.d.ts +64 -66
- package/lib/types/NormalToolbar/NormalToolbar.d.ts +1 -1
- package/lib/types/NormalToolbar/index.d.ts +30 -58
- package/lib/umd/index.js +42 -42
- package/package.json +4 -4
package/lib/cjs/MdModal.cjs
CHANGED
package/lib/cjs/MdPreview.cjs
CHANGED
package/lib/cjs/ModalToolbar.cjs
CHANGED
|
@@ -1 +1,124 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
const vue = require("vue");
|
|
3
|
+
const config = require("./chunks/config.cjs");
|
|
4
|
+
const vueTsx = require("./chunks/vue-tsx.cjs");
|
|
5
|
+
const MdModal = require("./chunks/index3.cjs");
|
|
6
|
+
function _isSlot(s) {
|
|
7
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
|
|
8
|
+
}
|
|
9
|
+
const props = {
|
|
10
|
+
title: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: ""
|
|
13
|
+
},
|
|
14
|
+
modalTitle: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
visible: {
|
|
19
|
+
type: Boolean
|
|
20
|
+
},
|
|
21
|
+
width: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "auto"
|
|
24
|
+
},
|
|
25
|
+
height: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "auto"
|
|
28
|
+
},
|
|
29
|
+
// 展示在工具栏的内容,通常是个图标
|
|
30
|
+
trigger: {
|
|
31
|
+
type: [String, Object]
|
|
32
|
+
},
|
|
33
|
+
onClick: {
|
|
34
|
+
type: Function
|
|
35
|
+
},
|
|
36
|
+
onClose: {
|
|
37
|
+
type: Function
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* 显示全屏按钮
|
|
41
|
+
*/
|
|
42
|
+
showAdjust: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
isFullscreen: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
onAdjust: {
|
|
51
|
+
type: Function
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* ==没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
|
|
55
|
+
*/
|
|
56
|
+
insert: {
|
|
57
|
+
type: Function
|
|
58
|
+
},
|
|
59
|
+
language: {
|
|
60
|
+
type: String
|
|
61
|
+
},
|
|
62
|
+
theme: {
|
|
63
|
+
type: String
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* ==结束
|
|
67
|
+
*/
|
|
68
|
+
};
|
|
69
|
+
const ModalToolbar = /* @__PURE__ */ vue.defineComponent({
|
|
70
|
+
name: "ModalToolbar",
|
|
71
|
+
props,
|
|
72
|
+
emits: ["onClick", "onClose", "onAdjust"],
|
|
73
|
+
setup(props2, ctx) {
|
|
74
|
+
return () => {
|
|
75
|
+
const Trigger = vueTsx.getSlot({
|
|
76
|
+
props: props2,
|
|
77
|
+
ctx
|
|
78
|
+
}, "trigger");
|
|
79
|
+
const Default = vueTsx.getSlot({
|
|
80
|
+
props: props2,
|
|
81
|
+
ctx
|
|
82
|
+
}, "default");
|
|
83
|
+
return vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
|
|
84
|
+
"class": `${config.prefix}-toolbar-item`,
|
|
85
|
+
"title": props2.title,
|
|
86
|
+
"onClick": () => {
|
|
87
|
+
if (props2.onClick instanceof Function) {
|
|
88
|
+
props2.onClick();
|
|
89
|
+
} else {
|
|
90
|
+
ctx.emit("onClick");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, [Trigger]), vue.createVNode(MdModal.MdModal, {
|
|
94
|
+
"width": props2.width,
|
|
95
|
+
"height": props2.height,
|
|
96
|
+
"title": props2.modalTitle,
|
|
97
|
+
"visible": props2.visible,
|
|
98
|
+
"onClose": () => {
|
|
99
|
+
if (props2.onClose instanceof Function) {
|
|
100
|
+
props2.onClose();
|
|
101
|
+
} else {
|
|
102
|
+
ctx.emit("onClose");
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"showAdjust": props2.showAdjust,
|
|
106
|
+
"isFullscreen": props2.isFullscreen,
|
|
107
|
+
"onAdjust": (v) => {
|
|
108
|
+
if (props2.onAdjust instanceof Function) {
|
|
109
|
+
props2.onAdjust(v);
|
|
110
|
+
} else {
|
|
111
|
+
ctx.emit("onAdjust", v);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, _isSlot(Default) ? Default : {
|
|
115
|
+
default: () => [Default]
|
|
116
|
+
})]);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
ModalToolbar.install = (app) => {
|
|
121
|
+
app.component(ModalToolbar.name, ModalToolbar);
|
|
122
|
+
return app;
|
|
123
|
+
};
|
|
124
|
+
module.exports = ModalToolbar;
|
|
@@ -1 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
const vue = require("vue");
|
|
3
|
+
const config = require("./chunks/config.cjs");
|
|
4
|
+
const vueTsx = require("./chunks/vue-tsx.cjs");
|
|
5
|
+
const props = {
|
|
6
|
+
title: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: ""
|
|
9
|
+
},
|
|
10
|
+
// 展示在工具栏的内容,通常是个图标
|
|
11
|
+
trigger: {
|
|
12
|
+
type: [String, Object]
|
|
13
|
+
},
|
|
14
|
+
onClick: {
|
|
15
|
+
type: Function
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* ==没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
|
|
19
|
+
*/
|
|
20
|
+
insert: {
|
|
21
|
+
type: Function
|
|
22
|
+
},
|
|
23
|
+
language: {
|
|
24
|
+
type: String
|
|
25
|
+
},
|
|
26
|
+
theme: {
|
|
27
|
+
type: String
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* ==结束
|
|
31
|
+
*/
|
|
32
|
+
};
|
|
33
|
+
const NormalToolbar = /* @__PURE__ */ vue.defineComponent({
|
|
34
|
+
name: "NormalToolbar",
|
|
35
|
+
props,
|
|
36
|
+
emits: ["onClick"],
|
|
37
|
+
setup(props2, ctx) {
|
|
38
|
+
return () => {
|
|
39
|
+
const Trigger = vueTsx.getSlot({
|
|
40
|
+
props: props2,
|
|
41
|
+
ctx
|
|
42
|
+
}, "trigger");
|
|
43
|
+
return vue.createVNode("div", {
|
|
44
|
+
"class": `${config.prefix}-toolbar-item`,
|
|
45
|
+
"title": props2.title,
|
|
46
|
+
"onClick": (e) => {
|
|
47
|
+
if (props2.onClick instanceof Function) {
|
|
48
|
+
props2.onClick(e);
|
|
49
|
+
} else {
|
|
50
|
+
ctx.emit("onClick", e);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [Trigger]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
NormalToolbar.install = (app) => {
|
|
58
|
+
app.component(NormalToolbar.name, NormalToolbar);
|
|
59
|
+
return app;
|
|
60
|
+
};
|
|
61
|
+
module.exports = NormalToolbar;
|
|
@@ -1 +1,290 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
const prefix = "md-editor";
|
|
3
|
+
const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_prouiefeic.js";
|
|
4
|
+
const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_prouiefeic.css";
|
|
5
|
+
const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
|
|
6
|
+
const highlightUrl = `${cdnBase}/highlight.js/11.8.0/highlight.min.js`;
|
|
7
|
+
const prettierUrl = {
|
|
8
|
+
main: `${cdnBase}/prettier/2.8.0/standalone.js`,
|
|
9
|
+
markdown: `${cdnBase}/prettier/2.8.0/parser-markdown.js`
|
|
10
|
+
};
|
|
11
|
+
const cropperUrl = {
|
|
12
|
+
css: `${cdnBase}/cropperjs/1.5.13/cropper.min.css`,
|
|
13
|
+
js: `${cdnBase}/cropperjs/1.5.13/cropper.min.js`
|
|
14
|
+
};
|
|
15
|
+
const screenfullUrl = `${cdnBase}/screenfull.js/5.2.0/screenfull.min.js`;
|
|
16
|
+
const allToolbar = [
|
|
17
|
+
"bold",
|
|
18
|
+
"underline",
|
|
19
|
+
"italic",
|
|
20
|
+
"strikeThrough",
|
|
21
|
+
"-",
|
|
22
|
+
"title",
|
|
23
|
+
"sub",
|
|
24
|
+
"sup",
|
|
25
|
+
"quote",
|
|
26
|
+
"unorderedList",
|
|
27
|
+
"orderedList",
|
|
28
|
+
"task",
|
|
29
|
+
"-",
|
|
30
|
+
"codeRow",
|
|
31
|
+
"code",
|
|
32
|
+
"link",
|
|
33
|
+
"image",
|
|
34
|
+
"table",
|
|
35
|
+
"mermaid",
|
|
36
|
+
"katex",
|
|
37
|
+
"-",
|
|
38
|
+
"revoke",
|
|
39
|
+
"next",
|
|
40
|
+
"save",
|
|
41
|
+
"=",
|
|
42
|
+
"prettier",
|
|
43
|
+
"pageFullscreen",
|
|
44
|
+
"fullscreen",
|
|
45
|
+
"preview",
|
|
46
|
+
"htmlPreview",
|
|
47
|
+
"catalog",
|
|
48
|
+
"github"
|
|
49
|
+
];
|
|
50
|
+
const allFooter = ["markdownTotal", "=", "scrollSwitch"];
|
|
51
|
+
const staticTextDefault = {
|
|
52
|
+
"zh-CN": {
|
|
53
|
+
toolbarTips: {
|
|
54
|
+
bold: "加粗",
|
|
55
|
+
underline: "下划线",
|
|
56
|
+
italic: "斜体",
|
|
57
|
+
strikeThrough: "删除线",
|
|
58
|
+
title: "标题",
|
|
59
|
+
sub: "下标",
|
|
60
|
+
sup: "上标",
|
|
61
|
+
quote: "引用",
|
|
62
|
+
unorderedList: "无序列表",
|
|
63
|
+
orderedList: "有序列表",
|
|
64
|
+
task: "任务列表",
|
|
65
|
+
codeRow: "行内代码",
|
|
66
|
+
code: "块级代码",
|
|
67
|
+
link: "链接",
|
|
68
|
+
image: "图片",
|
|
69
|
+
table: "表格",
|
|
70
|
+
mermaid: "mermaid图",
|
|
71
|
+
katex: "katex公式",
|
|
72
|
+
revoke: "后退",
|
|
73
|
+
next: "前进",
|
|
74
|
+
save: "保存",
|
|
75
|
+
prettier: "美化",
|
|
76
|
+
pageFullscreen: "浏览器全屏",
|
|
77
|
+
fullscreen: "屏幕全屏",
|
|
78
|
+
preview: "预览",
|
|
79
|
+
htmlPreview: "html代码预览",
|
|
80
|
+
catalog: "目录",
|
|
81
|
+
github: "源码地址"
|
|
82
|
+
},
|
|
83
|
+
titleItem: {
|
|
84
|
+
h1: "一级标题",
|
|
85
|
+
h2: "二级标题",
|
|
86
|
+
h3: "三级标题",
|
|
87
|
+
h4: "四级标题",
|
|
88
|
+
h5: "五级标题",
|
|
89
|
+
h6: "六级标题"
|
|
90
|
+
},
|
|
91
|
+
imgTitleItem: {
|
|
92
|
+
link: "添加链接",
|
|
93
|
+
upload: "上传图片",
|
|
94
|
+
clip2upload: "裁剪上传"
|
|
95
|
+
},
|
|
96
|
+
linkModalTips: {
|
|
97
|
+
linkTitle: "添加链接",
|
|
98
|
+
imageTitle: "添加图片",
|
|
99
|
+
descLabel: "链接描述:",
|
|
100
|
+
descLabelPlaceHolder: "请输入描述...",
|
|
101
|
+
urlLabel: "链接地址:",
|
|
102
|
+
urlLabelPlaceHolder: "请输入链接...",
|
|
103
|
+
buttonOK: "确定"
|
|
104
|
+
},
|
|
105
|
+
clipModalTips: {
|
|
106
|
+
title: "裁剪图片上传",
|
|
107
|
+
buttonUpload: "上传"
|
|
108
|
+
},
|
|
109
|
+
copyCode: {
|
|
110
|
+
text: "复制代码",
|
|
111
|
+
successTips: "已复制!",
|
|
112
|
+
failTips: "复制失败!"
|
|
113
|
+
},
|
|
114
|
+
mermaid: {
|
|
115
|
+
flow: "流程图",
|
|
116
|
+
sequence: "时序图",
|
|
117
|
+
gantt: "甘特图",
|
|
118
|
+
class: "类图",
|
|
119
|
+
state: "状态图",
|
|
120
|
+
pie: "饼图",
|
|
121
|
+
relationship: "关系图",
|
|
122
|
+
journey: "旅程图"
|
|
123
|
+
},
|
|
124
|
+
katex: {
|
|
125
|
+
inline: "行内公式",
|
|
126
|
+
block: "块级公式"
|
|
127
|
+
},
|
|
128
|
+
footer: {
|
|
129
|
+
markdownTotal: "字数",
|
|
130
|
+
scrollAuto: "同步滚动"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"en-US": {
|
|
134
|
+
toolbarTips: {
|
|
135
|
+
bold: "bold",
|
|
136
|
+
underline: "underline",
|
|
137
|
+
italic: "italic",
|
|
138
|
+
strikeThrough: "strikeThrough",
|
|
139
|
+
title: "title",
|
|
140
|
+
sub: "subscript",
|
|
141
|
+
sup: "superscript",
|
|
142
|
+
quote: "quote",
|
|
143
|
+
unorderedList: "unordered list",
|
|
144
|
+
orderedList: "ordered list",
|
|
145
|
+
task: "task list",
|
|
146
|
+
codeRow: "inline code",
|
|
147
|
+
code: "block-level code",
|
|
148
|
+
link: "link",
|
|
149
|
+
image: "image",
|
|
150
|
+
table: "table",
|
|
151
|
+
mermaid: "mermaid",
|
|
152
|
+
katex: "formula",
|
|
153
|
+
revoke: "revoke",
|
|
154
|
+
next: "undo revoke",
|
|
155
|
+
save: "save",
|
|
156
|
+
prettier: "prettier",
|
|
157
|
+
pageFullscreen: "fullscreen in page",
|
|
158
|
+
fullscreen: "fullscreen",
|
|
159
|
+
preview: "preview",
|
|
160
|
+
htmlPreview: "html preview",
|
|
161
|
+
catalog: "catalog",
|
|
162
|
+
github: "source code"
|
|
163
|
+
},
|
|
164
|
+
titleItem: {
|
|
165
|
+
h1: "Lv1 Heading",
|
|
166
|
+
h2: "Lv2 Heading",
|
|
167
|
+
h3: "Lv3 Heading",
|
|
168
|
+
h4: "Lv4 Heading",
|
|
169
|
+
h5: "Lv5 Heading",
|
|
170
|
+
h6: "Lv6 Heading"
|
|
171
|
+
},
|
|
172
|
+
imgTitleItem: {
|
|
173
|
+
link: "Add Img Link",
|
|
174
|
+
upload: "Upload Img",
|
|
175
|
+
clip2upload: "Clip Upload"
|
|
176
|
+
},
|
|
177
|
+
linkModalTips: {
|
|
178
|
+
linkTitle: "Add Link",
|
|
179
|
+
imageTitle: "Add Image",
|
|
180
|
+
descLabel: "Desc:",
|
|
181
|
+
descLabelPlaceHolder: "Enter a description...",
|
|
182
|
+
urlLabel: "Link:",
|
|
183
|
+
urlLabelPlaceHolder: "Enter a link...",
|
|
184
|
+
buttonOK: "OK"
|
|
185
|
+
},
|
|
186
|
+
clipModalTips: {
|
|
187
|
+
title: "Crop Image",
|
|
188
|
+
buttonUpload: "Upload"
|
|
189
|
+
},
|
|
190
|
+
copyCode: {
|
|
191
|
+
text: "Copy",
|
|
192
|
+
successTips: "Copied!",
|
|
193
|
+
failTips: "Copy failed!"
|
|
194
|
+
},
|
|
195
|
+
mermaid: {
|
|
196
|
+
flow: "flow",
|
|
197
|
+
sequence: "sequence",
|
|
198
|
+
gantt: "gantt",
|
|
199
|
+
class: "class",
|
|
200
|
+
state: "state",
|
|
201
|
+
pie: "pie",
|
|
202
|
+
relationship: "relationship",
|
|
203
|
+
journey: "journey"
|
|
204
|
+
},
|
|
205
|
+
katex: {
|
|
206
|
+
inline: "inline",
|
|
207
|
+
block: "block"
|
|
208
|
+
},
|
|
209
|
+
footer: {
|
|
210
|
+
markdownTotal: "Character Count",
|
|
211
|
+
scrollAuto: "Scroll Auto"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
const mermaidUrl = `${cdnBase}/mermaid/10.6.1/mermaid.esm.min.mjs`;
|
|
216
|
+
const katexUrl = {
|
|
217
|
+
js: `${cdnBase}/KaTeX/0.16.9/katex.min.js`,
|
|
218
|
+
css: `${cdnBase}/KaTeX/0.16.9/katex.min.css`
|
|
219
|
+
};
|
|
220
|
+
const codeCss = {
|
|
221
|
+
a11y: {
|
|
222
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/a11y-light.min.css`,
|
|
223
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/a11y-dark.min.css`
|
|
224
|
+
},
|
|
225
|
+
atom: {
|
|
226
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/atom-one-light.min.css`,
|
|
227
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/atom-one-dark.min.css`
|
|
228
|
+
},
|
|
229
|
+
github: {
|
|
230
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/github.min.css`,
|
|
231
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/github-dark.min.css`
|
|
232
|
+
},
|
|
233
|
+
gradient: {
|
|
234
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/gradient-light.min.css`,
|
|
235
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/gradient-dark.min.css`
|
|
236
|
+
},
|
|
237
|
+
kimbie: {
|
|
238
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/kimbie-light.min.css`,
|
|
239
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/kimbie-dark.min.css`
|
|
240
|
+
},
|
|
241
|
+
paraiso: {
|
|
242
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/paraiso-light.min.css`,
|
|
243
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/paraiso-dark.min.css`
|
|
244
|
+
},
|
|
245
|
+
qtcreator: {
|
|
246
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/qtcreator-light.min.css`,
|
|
247
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/qtcreator-dark.min.css`
|
|
248
|
+
},
|
|
249
|
+
stackoverflow: {
|
|
250
|
+
light: `${cdnBase}/highlight.js/11.8.0/styles/stackoverflow-light.min.css`,
|
|
251
|
+
dark: `${cdnBase}/highlight.js/11.8.0/styles/stackoverflow-dark.min.css`
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
const configOption = {
|
|
255
|
+
editorExtensions: {},
|
|
256
|
+
editorConfig: {},
|
|
257
|
+
codeMirrorExtensions: (_theme, innerExtensions) => innerExtensions,
|
|
258
|
+
markdownItConfig: () => {
|
|
259
|
+
},
|
|
260
|
+
markdownItPlugins: (s) => s,
|
|
261
|
+
iconfontType: "svg",
|
|
262
|
+
mermaidConfig: (c) => c
|
|
263
|
+
};
|
|
264
|
+
const config = (option) => {
|
|
265
|
+
if (option) {
|
|
266
|
+
for (const key in option) {
|
|
267
|
+
const optionItem = option[key];
|
|
268
|
+
if (optionItem) {
|
|
269
|
+
configOption[key] = optionItem;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
const MinInputBoxWidth = 170;
|
|
275
|
+
exports.MinInputBoxWidth = MinInputBoxWidth;
|
|
276
|
+
exports.allFooter = allFooter;
|
|
277
|
+
exports.allToolbar = allToolbar;
|
|
278
|
+
exports.codeCss = codeCss;
|
|
279
|
+
exports.config = config;
|
|
280
|
+
exports.configOption = configOption;
|
|
281
|
+
exports.cropperUrl = cropperUrl;
|
|
282
|
+
exports.highlightUrl = highlightUrl;
|
|
283
|
+
exports.iconfontClassUrl = iconfontClassUrl;
|
|
284
|
+
exports.iconfontSvgUrl = iconfontSvgUrl;
|
|
285
|
+
exports.katexUrl = katexUrl;
|
|
286
|
+
exports.mermaidUrl = mermaidUrl;
|
|
287
|
+
exports.prefix = prefix;
|
|
288
|
+
exports.prettierUrl = prettierUrl;
|
|
289
|
+
exports.screenfullUrl = screenfullUrl;
|
|
290
|
+
exports.staticTextDefault = staticTextDefault;
|
package/lib/cjs/chunks/dom.cjs
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
const util = require("@vavt/util");
|
|
3
|
+
const keyMove = (trigger, moveHandler) => {
|
|
4
|
+
const triggerMouseDown = (mdown) => {
|
|
5
|
+
const parent = trigger.parentElement || document.body;
|
|
6
|
+
const width = parent.offsetWidth;
|
|
7
|
+
const height = parent.offsetHeight;
|
|
8
|
+
const { clientWidth } = document.documentElement;
|
|
9
|
+
const { clientHeight } = document.documentElement;
|
|
10
|
+
const x = mdown.offsetX;
|
|
11
|
+
const y = mdown.offsetY;
|
|
12
|
+
const mouseMoveHandler = (e) => {
|
|
13
|
+
let tx = e.x + document.body.scrollLeft - document.body.clientLeft - x;
|
|
14
|
+
let ty = e.y + document.body.scrollTop - document.body.clientTop - y;
|
|
15
|
+
tx = tx < 1 ? 1 : tx < clientWidth - width - 1 ? tx : clientWidth - width - 1;
|
|
16
|
+
ty = ty < 1 ? 1 : ty < clientHeight - height - 1 ? ty : clientHeight - height - 1;
|
|
17
|
+
if (moveHandler) {
|
|
18
|
+
moveHandler(tx, ty);
|
|
19
|
+
} else {
|
|
20
|
+
parent.style.left = `${tx}px`;
|
|
21
|
+
parent.style.top = `${ty}px`;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
document.addEventListener("mousemove", mouseMoveHandler);
|
|
25
|
+
const mouseUpHandler = () => {
|
|
26
|
+
document.removeEventListener("mousemove", mouseMoveHandler);
|
|
27
|
+
document.removeEventListener("mouseup", mouseUpHandler);
|
|
28
|
+
};
|
|
29
|
+
document.addEventListener("mouseup", mouseUpHandler);
|
|
30
|
+
};
|
|
31
|
+
trigger.addEventListener("mousedown", triggerMouseDown);
|
|
32
|
+
return () => {
|
|
33
|
+
trigger.removeEventListener("mousedown", triggerMouseDown);
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const appendHandler = (ele, checkKey = "") => {
|
|
37
|
+
const insertedEle = document.getElementById(ele.id);
|
|
38
|
+
const onload_ = ele.onload;
|
|
39
|
+
ele.onload = null;
|
|
40
|
+
const onload = function(e) {
|
|
41
|
+
if (typeof onload_ === "function") {
|
|
42
|
+
onload_.bind(this)(e);
|
|
43
|
+
}
|
|
44
|
+
ele.removeEventListener("load", onload);
|
|
45
|
+
};
|
|
46
|
+
if (!insertedEle) {
|
|
47
|
+
ele.addEventListener("load", onload);
|
|
48
|
+
document.head.appendChild(ele);
|
|
49
|
+
} else if (checkKey !== "") {
|
|
50
|
+
insertedEle.addEventListener("load", onload);
|
|
51
|
+
if (Reflect.get(window, checkKey)) {
|
|
52
|
+
insertedEle.dispatchEvent(new Event("load"));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const updateHandler = util.debounce((id, attr, value) => {
|
|
57
|
+
const ele = document.getElementById(id);
|
|
58
|
+
if (ele) {
|
|
59
|
+
ele.setAttribute(attr, value);
|
|
60
|
+
}
|
|
61
|
+
}, 10);
|
|
62
|
+
exports.appendHandler = appendHandler;
|
|
63
|
+
exports.keyMove = keyMove;
|
|
64
|
+
exports.updateHandler = updateHandler;
|