md-editor-v3 4.12.0-beta.2 → 4.12.1

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.
Files changed (43) hide show
  1. package/README.md +12 -0
  2. package/lib/cjs/DropdownToolbar.cjs +3 -1
  3. package/lib/cjs/MdCatalog.cjs +270 -1
  4. package/lib/cjs/MdEditor.cjs +3101 -58
  5. package/lib/cjs/MdModal.cjs +3 -1
  6. package/lib/cjs/MdPreview.cjs +3 -1
  7. package/lib/cjs/ModalToolbar.cjs +124 -1
  8. package/lib/cjs/NormalToolbar.cjs +61 -1
  9. package/lib/cjs/chunks/config.cjs +290 -1
  10. package/lib/cjs/chunks/dom.cjs +64 -1
  11. package/lib/cjs/chunks/index.cjs +1863 -8
  12. package/lib/cjs/chunks/index2.cjs +198 -1
  13. package/lib/cjs/chunks/index3.cjs +270 -1
  14. package/lib/cjs/chunks/index4.cjs +141 -2
  15. package/lib/cjs/chunks/vue-tsx.cjs +10 -1
  16. package/lib/cjs/config.cjs +12 -1
  17. package/lib/cjs/index.cjs +25 -1
  18. package/lib/es/DropdownToolbar.mjs +2 -2
  19. package/lib/es/MdCatalog.mjs +164 -114
  20. package/lib/es/MdEditor.mjs +2297 -1654
  21. package/lib/es/MdModal.mjs +2 -2
  22. package/lib/es/MdPreview.mjs +2 -2
  23. package/lib/es/ModalToolbar.mjs +55 -38
  24. package/lib/es/NormalToolbar.mjs +26 -18
  25. package/lib/es/chunks/config.mjs +73 -54
  26. package/lib/es/chunks/dom.mjs +57 -24
  27. package/lib/es/chunks/index.mjs +1099 -609
  28. package/lib/es/chunks/index2.mjs +126 -78
  29. package/lib/es/chunks/index3.mjs +185 -111
  30. package/lib/es/chunks/index4.mjs +124 -72
  31. package/lib/es/chunks/vue-tsx.mjs +8 -8
  32. package/lib/es/config.mjs +11 -10
  33. package/lib/es/index.mjs +23 -23
  34. package/lib/preview.css +200 -1
  35. package/lib/style.css +592 -1
  36. package/lib/types/MdEditor/components/Modal/Modal.d.ts +1 -1
  37. package/lib/types/MdEditor/components/Modal/index.d.ts +3 -3
  38. package/lib/types/MdEditor/layouts/Content/index.d.ts +9 -0
  39. package/lib/types/MdEditor/layouts/Content/props.d.ts +4 -0
  40. package/lib/types/MdEditor/static/event-name.d.ts +1 -0
  41. package/lib/types/MdEditor/type.d.ts +10 -1
  42. package/lib/umd/index.js +75625 -114
  43. package/package.json +1 -1
@@ -1 +1,3 @@
1
- "use strict";const d=require("./chunks/index3.cjs");module.exports=d.MdModal;
1
+ "use strict";
2
+ const MdModal = require("./chunks/index3.cjs");
3
+ module.exports = MdModal.MdModal;
@@ -1 +1,3 @@
1
- "use strict";const e=require("./chunks/index.cjs");module.exports=e.MdPreview;
1
+ "use strict";
2
+ const MdPreview = require("./chunks/index.cjs");
3
+ module.exports = MdPreview.MdPreview;
@@ -1 +1,124 @@
1
- "use strict";const t=require("vue"),a=require("./chunks/config.cjs"),u=require("./chunks/vue-tsx.cjs"),c=require("./chunks/index3.cjs");function d(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const r={title:{type:String,default:""},modalTitle:{type:String,default:""},visible:{type:Boolean},width:{type:String,default:"auto"},height:{type:String,default:"auto"},trigger:{type:[String,Object]},onClick:{type:Function},onClose:{type:Function},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function},insert:{type:Function},language:{type:String},theme:{type:String}},o=t.defineComponent({name:"ModalToolbar",props:r,emits:["onClick","onClose","onAdjust"],setup(e,n){return()=>{const s=u.getSlot({props:e,ctx:n},"trigger"),i=u.getSlot({props:e,ctx:n},"default");return t.createVNode(t.Fragment,null,[t.createVNode("div",{class:`${a.prefix}-toolbar-item`,title:e.title,onClick:()=>{e.onClick instanceof Function?e.onClick():n.emit("onClick")}},[s]),t.createVNode(c.MdModal,{width:e.width,height:e.height,title:e.modalTitle,visible:e.visible,onClose:()=>{e.onClose instanceof Function?e.onClose():n.emit("onClose")},showAdjust:e.showAdjust,isFullscreen:e.isFullscreen,onAdjust:l=>{e.onAdjust instanceof Function?e.onAdjust(l):n.emit("onAdjust",l)}},d(i)?i:{default:()=>[i]})])}}});o.install=e=>(e.component(o.name,o),e);module.exports=o;
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";const o=require("vue"),c=require("./chunks/config.cjs"),l=require("./chunks/vue-tsx.cjs"),s={title:{type:String,default:""},trigger:{type:[String,Object]},onClick:{type:Function},insert:{type:Function},language:{type:String},theme:{type:String}},t=o.defineComponent({name:"NormalToolbar",props:s,emits:["onClick"],setup(e,n){return()=>{const r=l.getSlot({props:e,ctx:n},"trigger");return o.createVNode("div",{class:`${c.prefix}-toolbar-item`,title:e.title,onClick:i=>{e.onClick instanceof Function?e.onClick(i):n.emit("onClick",i)}},[r])}}});t.install=e=>(e.component(t.name,t),e);module.exports=t;
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";const o="md-editor",r="https://at.alicdn.com/t/c/font_2605852_prouiefeic.js",a="https://at.alicdn.com/t/c/font_2605852_prouiefeic.css",e="https://cdnjs.cloudflare.com/ajax/libs",n=`${e}/highlight.js/11.8.0/highlight.min.js`,c={main:`${e}/prettier/2.8.0/standalone.js`,markdown:`${e}/prettier/2.8.0/parser-markdown.js`},d={css:`${e}/cropperjs/1.5.13/cropper.min.css`,js:`${e}/cropperjs/1.5.13/cropper.min.js`},h=`${e}/screenfull.js/5.2.0/screenfull.min.js`,g=["bold","underline","italic","strikeThrough","-","title","sub","sup","quote","unorderedList","orderedList","task","-","codeRow","code","link","image","table","mermaid","katex","-","revoke","next","save","=","prettier","pageFullscreen","fullscreen","preview","htmlPreview","catalog","github"],m=["markdownTotal","=","scrollSwitch"],p={"zh-CN":{toolbarTips:{bold:"加粗",underline:"下划线",italic:"斜体",strikeThrough:"删除线",title:"标题",sub:"下标",sup:"上标",quote:"引用",unorderedList:"无序列表",orderedList:"有序列表",task:"任务列表",codeRow:"行内代码",code:"块级代码",link:"链接",image:"图片",table:"表格",mermaid:"mermaid图",katex:"katex公式",revoke:"后退",next:"前进",save:"保存",prettier:"美化",pageFullscreen:"浏览器全屏",fullscreen:"屏幕全屏",preview:"预览",htmlPreview:"html代码预览",catalog:"目录",github:"源码地址"},titleItem:{h1:"一级标题",h2:"二级标题",h3:"三级标题",h4:"四级标题",h5:"五级标题",h6:"六级标题"},imgTitleItem:{link:"添加链接",upload:"上传图片",clip2upload:"裁剪上传"},linkModalTips:{linkTitle:"添加链接",imageTitle:"添加图片",descLabel:"链接描述:",descLabelPlaceHolder:"请输入描述...",urlLabel:"链接地址:",urlLabelPlaceHolder:"请输入链接...",buttonOK:"确定"},clipModalTips:{title:"裁剪图片上传",buttonUpload:"上传"},copyCode:{text:"复制代码",successTips:"已复制!",failTips:"复制失败!"},mermaid:{flow:"流程图",sequence:"时序图",gantt:"甘特图",class:"类图",state:"状态图",pie:"饼图",relationship:"关系图",journey:"旅程图"},katex:{inline:"行内公式",block:"块级公式"},footer:{markdownTotal:"字数",scrollAuto:"同步滚动"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Img Link",upload:"Upload Img",clip2upload:"Clip Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Character Count",scrollAuto:"Scroll Auto"}}},u=`${e}/mermaid/10.6.1/mermaid.esm.min.mjs`,k={js:`${e}/KaTeX/0.16.9/katex.min.js`,css:`${e}/KaTeX/0.16.9/katex.min.css`},f={a11y:{light:`${e}/highlight.js/11.8.0/styles/a11y-light.min.css`,dark:`${e}/highlight.js/11.8.0/styles/a11y-dark.min.css`},atom:{light:`${e}/highlight.js/11.8.0/styles/atom-one-light.min.css`,dark:`${e}/highlight.js/11.8.0/styles/atom-one-dark.min.css`},github:{light:`${e}/highlight.js/11.8.0/styles/github.min.css`,dark:`${e}/highlight.js/11.8.0/styles/github-dark.min.css`},gradient:{light:`${e}/highlight.js/11.8.0/styles/gradient-light.min.css`,dark:`${e}/highlight.js/11.8.0/styles/gradient-dark.min.css`},kimbie:{light:`${e}/highlight.js/11.8.0/styles/kimbie-light.min.css`,dark:`${e}/highlight.js/11.8.0/styles/kimbie-dark.min.css`},paraiso:{light:`${e}/highlight.js/11.8.0/styles/paraiso-light.min.css`,dark:`${e}/highlight.js/11.8.0/styles/paraiso-dark.min.css`},qtcreator:{light:`${e}/highlight.js/11.8.0/styles/qtcreator-light.min.css`,dark:`${e}/highlight.js/11.8.0/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${e}/highlight.js/11.8.0/styles/stackoverflow-light.min.css`,dark:`${e}/highlight.js/11.8.0/styles/stackoverflow-dark.min.css`}},s={editorExtensions:{},editorConfig:{},codeMirrorExtensions:(i,t)=>t,markdownItConfig:()=>{},markdownItPlugins:i=>i,iconfontType:"svg",mermaidConfig:i=>i},b=i=>{if(i)for(const t in i){const l=i[t];l&&(s[t]=l)}},j=170;exports.MinInputBoxWidth=j;exports.allFooter=m;exports.allToolbar=g;exports.codeCss=f;exports.config=b;exports.configOption=s;exports.cropperUrl=d;exports.highlightUrl=n;exports.iconfontClassUrl=a;exports.iconfontSvgUrl=r;exports.katexUrl=k;exports.mermaidUrl=u;exports.prefix=o;exports.prettierUrl=c;exports.screenfullUrl=h;exports.staticTextDefault=p;
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;
@@ -1 +1,64 @@
1
- "use strict";const E=require("@vavt/util"),y=(e,d)=>{const t=n=>{const o=e.parentElement||document.body,u=o.offsetWidth,i=o.offsetHeight,{clientWidth:l}=document.documentElement,{clientHeight:m}=document.documentElement,p=n.offsetX,v=n.offsetY,a=f=>{let s=f.x+document.body.scrollLeft-document.body.clientLeft-p,c=f.y+document.body.scrollTop-document.body.clientTop-v;s=s<1?1:s<l-u-1?s:l-u-1,c=c<1?1:c<m-i-1?c:m-i-1,d?d(s,c):(o.style.left=`${s}px`,o.style.top=`${c}px`)};document.addEventListener("mousemove",a);const r=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",r)};document.addEventListener("mouseup",r)};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},L=(e,d="")=>{const t=document.getElementById(e.id),n=e.onload;e.onload=null;const o=function(u){typeof n=="function"&&n.bind(this)(u),e.removeEventListener("load",o)};t?d!==""&&(t.addEventListener("load",o),Reflect.get(window,d)&&t.dispatchEvent(new Event("load"))):(e.addEventListener("load",o),document.head.appendChild(e))},h=E.debounce((e,d,t)=>{const n=document.getElementById(e);n&&n.setAttribute(d,t)},10);exports.appendHandler=L;exports.keyMove=y;exports.updateHandler=h;
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;