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/es/chunks/index4.mjs
CHANGED
|
@@ -1,91 +1,142 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
class Bus {
|
|
5
8
|
constructor() {
|
|
6
9
|
// 事件池
|
|
7
|
-
|
|
10
|
+
__publicField(this, "pools", {});
|
|
8
11
|
}
|
|
9
12
|
// 移除事件监听
|
|
10
|
-
remove(
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
+
remove(race, name, func) {
|
|
14
|
+
const targetRace = this.pools[race];
|
|
15
|
+
const events = targetRace && this.pools[race][name];
|
|
16
|
+
if (events) {
|
|
17
|
+
this.pools[race][name] = events.filter((item) => item !== func);
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
20
|
// 清空全部事件,由于单一实例,多次注册会被共享内容
|
|
15
|
-
clear(
|
|
16
|
-
this.pools[
|
|
21
|
+
clear(race) {
|
|
22
|
+
this.pools[race] = {};
|
|
17
23
|
}
|
|
18
24
|
// 注册事件监听
|
|
19
|
-
on(
|
|
20
|
-
|
|
25
|
+
on(race, event) {
|
|
26
|
+
if (!this.pools[race]) {
|
|
27
|
+
this.pools[race] = {};
|
|
28
|
+
}
|
|
29
|
+
if (!this.pools[race][event.name]) {
|
|
30
|
+
this.pools[race][event.name] = [];
|
|
31
|
+
}
|
|
32
|
+
this.pools[race][event.name].push(event.callback);
|
|
33
|
+
return this.pools[race][event.name].includes(event.callback);
|
|
21
34
|
}
|
|
22
35
|
// 触发事件
|
|
23
|
-
emit(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
emit(race, name, ...params) {
|
|
37
|
+
if (!this.pools[race]) {
|
|
38
|
+
this.pools[race] = {};
|
|
39
|
+
}
|
|
40
|
+
const targetRace = this.pools[race];
|
|
41
|
+
const events = targetRace[name];
|
|
42
|
+
if (events) {
|
|
43
|
+
events.forEach((item) => {
|
|
44
|
+
try {
|
|
45
|
+
item(...params);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error(`${name} monitor event exception!`, error);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
33
51
|
}
|
|
34
52
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
const bus = new Bus();
|
|
54
|
+
const ON_SAVE = "onSave";
|
|
55
|
+
const CHANGE_CATALOG_VISIBLE = "changeCatalogVisible";
|
|
56
|
+
const CHANGE_FULL_SCREEN = "changeFullscreen";
|
|
57
|
+
const PAGE_FULL_SCREEN_CHANGED = "pageFullscreenChanged";
|
|
58
|
+
const FULL_SCREEN_CHANGED = "fullscreenChanged";
|
|
59
|
+
const PREVIEW_CHANGED = "previewChanged";
|
|
60
|
+
const HTML_PREVIEW_CHANGED = "htmlPreviewChanged";
|
|
61
|
+
const CATALOG_VISIBLE_CHANGED = "catalogVisibleChanged";
|
|
62
|
+
const BUILD_FINISHED = "buildFinished";
|
|
63
|
+
const ERROR_CATCHER = "errorCatcher";
|
|
64
|
+
const REPLACE = "replace";
|
|
65
|
+
const UPLOAD_IMAGE = "uploadImage";
|
|
66
|
+
const OPEN_MODALS = "openModals";
|
|
67
|
+
const CTRL_Z = "ctrlZ";
|
|
68
|
+
const CTRL_SHIFT_Z = "ctrlShiftZ";
|
|
69
|
+
const CATALOG_CHANGED = "catalogChanged";
|
|
70
|
+
const PUSH_CATALOG = "pushCatalog";
|
|
71
|
+
const RERENDER = "rerender";
|
|
72
|
+
const EVENT_LISTENER = "eventListener";
|
|
73
|
+
const base642File = (base64, fileName = "image.png") => {
|
|
74
|
+
const arr = base64.split(",");
|
|
75
|
+
const regResult = arr[0].match(/:(.*?);/);
|
|
76
|
+
if (regResult) {
|
|
77
|
+
const mime = regResult[1];
|
|
78
|
+
const bstr = atob(arr[1]);
|
|
79
|
+
let n = bstr.length;
|
|
80
|
+
const u8arr = new Uint8Array(n);
|
|
81
|
+
while (n--) {
|
|
82
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
83
|
+
}
|
|
84
|
+
return new File([u8arr], fileName, { type: mime });
|
|
44
85
|
}
|
|
45
86
|
return null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
87
|
+
};
|
|
88
|
+
const generateCodeRowNumber = (code) => {
|
|
89
|
+
if (!code) {
|
|
90
|
+
return code;
|
|
91
|
+
}
|
|
92
|
+
const list = code.split("\n");
|
|
93
|
+
const rowNumberList = ['<span rn-wrapper aria-hidden="true">'];
|
|
94
|
+
list.forEach(() => {
|
|
95
|
+
rowNumberList.push("<span></span>");
|
|
96
|
+
});
|
|
97
|
+
rowNumberList.push("</span>");
|
|
98
|
+
return `<span class="code-block">${code}</span>${rowNumberList.join("")}`;
|
|
99
|
+
};
|
|
100
|
+
const getRelativeTop = (element, container) => {
|
|
101
|
+
if (!element || !container) {
|
|
56
102
|
return 0;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
103
|
+
}
|
|
104
|
+
const eleRect = element == null ? void 0 : element.getBoundingClientRect();
|
|
105
|
+
if (container === document.documentElement) {
|
|
106
|
+
return eleRect.top - container.clientTop;
|
|
107
|
+
}
|
|
108
|
+
const conRect = container == null ? void 0 : container.getBoundingClientRect();
|
|
109
|
+
return eleRect.top - conRect.top;
|
|
110
|
+
};
|
|
111
|
+
const getNextId = /* @__PURE__ */ (() => {
|
|
112
|
+
let count = 0;
|
|
113
|
+
return (prefix) => {
|
|
114
|
+
return prefix + ++count;
|
|
115
|
+
};
|
|
65
116
|
})();
|
|
66
117
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
118
|
+
BUILD_FINISHED as B,
|
|
119
|
+
CATALOG_CHANGED as C,
|
|
120
|
+
ERROR_CATCHER as E,
|
|
121
|
+
FULL_SCREEN_CHANGED as F,
|
|
122
|
+
HTML_PREVIEW_CHANGED as H,
|
|
123
|
+
ON_SAVE as O,
|
|
124
|
+
PUSH_CATALOG as P,
|
|
125
|
+
RERENDER as R,
|
|
126
|
+
UPLOAD_IMAGE as U,
|
|
127
|
+
generateCodeRowNumber as a,
|
|
128
|
+
bus as b,
|
|
129
|
+
CHANGE_CATALOG_VISIBLE as c,
|
|
130
|
+
PAGE_FULL_SCREEN_CHANGED as d,
|
|
131
|
+
PREVIEW_CHANGED as e,
|
|
132
|
+
CATALOG_VISIBLE_CHANGED as f,
|
|
133
|
+
getRelativeTop as g,
|
|
134
|
+
REPLACE as h,
|
|
135
|
+
CHANGE_FULL_SCREEN as i,
|
|
136
|
+
EVENT_LISTENER as j,
|
|
137
|
+
getNextId as k,
|
|
138
|
+
base642File as l,
|
|
139
|
+
OPEN_MODALS as m,
|
|
140
|
+
CTRL_SHIFT_Z as n,
|
|
141
|
+
CTRL_Z as o
|
|
91
142
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
instance
|
|
3
|
-
ctx
|
|
4
|
-
props
|
|
5
|
-
},
|
|
6
|
-
const
|
|
7
|
-
return (
|
|
1
|
+
const getSlot = ({
|
|
2
|
+
instance,
|
|
3
|
+
ctx,
|
|
4
|
+
props = {}
|
|
5
|
+
}, name = "default") => {
|
|
6
|
+
const targetSlot = (instance == null ? void 0 : instance.$slots[name]) || (ctx == null ? void 0 : ctx.slots[name]);
|
|
7
|
+
return (targetSlot ? targetSlot(instance) : "") || props[name];
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
getSlot as g
|
|
11
11
|
};
|
package/lib/es/config.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { s as
|
|
2
|
-
import { d
|
|
3
|
-
const
|
|
1
|
+
import { s as staticTextDefault } from "./chunks/config.mjs";
|
|
2
|
+
import { d, b, c, i, a } from "./chunks/config.mjs";
|
|
3
|
+
const zh_CN = staticTextDefault["zh-CN"];
|
|
4
|
+
const en_US = staticTextDefault["en-US"];
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
d as allFooter,
|
|
7
|
+
b as allToolbar,
|
|
8
|
+
c as config,
|
|
9
|
+
en_US,
|
|
10
|
+
i as iconfontClassUrl,
|
|
11
|
+
a as iconfontSvgUrl,
|
|
12
|
+
zh_CN
|
|
12
13
|
};
|
package/lib/es/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { M
|
|
3
|
-
import { default as
|
|
4
|
-
import { D
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
7
|
-
import { M as
|
|
8
|
-
import { en_US
|
|
9
|
-
import { d
|
|
1
|
+
import { default as default2 } from "./MdEditor.mjs";
|
|
2
|
+
import { M } from "./chunks/index.mjs";
|
|
3
|
+
import { default as default3 } from "./NormalToolbar.mjs";
|
|
4
|
+
import { D } from "./chunks/index2.mjs";
|
|
5
|
+
import { default as default4 } from "./ModalToolbar.mjs";
|
|
6
|
+
import { default as default5 } from "./MdCatalog.mjs";
|
|
7
|
+
import { M as M2 } from "./chunks/index3.mjs";
|
|
8
|
+
import { en_US, zh_CN } from "./config.mjs";
|
|
9
|
+
import { d, b, c, i, a } from "./chunks/config.mjs";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
D as DropdownToolbar,
|
|
12
|
+
default5 as MdCatalog,
|
|
13
|
+
default2 as MdEditor,
|
|
14
|
+
M2 as MdModal,
|
|
15
|
+
M as MdPreview,
|
|
16
|
+
default4 as ModalToolbar,
|
|
17
|
+
default3 as NormalToolbar,
|
|
18
|
+
d as allFooter,
|
|
19
|
+
b as allToolbar,
|
|
20
|
+
c as config,
|
|
21
|
+
en_US,
|
|
22
|
+
i as iconfontClassUrl,
|
|
23
|
+
a as iconfontSvgUrl,
|
|
24
|
+
zh_CN
|
|
25
25
|
};
|