md-editor-v3 4.3.0-beta.1 → 4.3.0-beta.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/README.md +28 -0
- package/lib/cjs/MdCatalog.cjs +1 -1
- package/lib/cjs/MdEditor.cjs +25 -25
- package/lib/cjs/MdModal.cjs +1 -0
- package/lib/cjs/MdPreview.cjs +1 -1
- package/lib/cjs/ModalToolbar.cjs +1 -1
- package/lib/cjs/chunks/config.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +7 -7
- package/lib/cjs/chunks/index3.cjs +2 -1
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdCatalog.mjs +1 -1
- package/lib/es/MdEditor.mjs +1046 -971
- package/lib/es/MdModal.mjs +141 -0
- package/lib/es/MdPreview.mjs +1 -1
- package/lib/es/ModalToolbar.mjs +97 -5
- package/lib/es/chunks/config.mjs +2 -1
- package/lib/es/chunks/index.mjs +369 -321
- package/lib/es/chunks/index3.mjs +61 -227
- package/lib/es/index.mjs +4 -2
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/Editor.d.ts +9 -0
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +78 -0
- package/lib/types/MdEditor/components/Modal/index.d.ts +173 -51
- package/lib/types/MdEditor/index.d.ts +20 -1
- package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +6 -0
- package/lib/types/MdEditor/layouts/Toolbar/props.d.ts +8 -0
- package/lib/types/MdEditor/props.d.ts +9 -0
- package/lib/types/MdEditor/type.d.ts +13 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/index.js +42 -42
- package/package.json +2 -2
- package/lib/cjs/chunks/index4.cjs +0 -2
- package/lib/es/chunks/index4.mjs +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "md-editor-v3",
|
|
3
|
-
"version": "4.3.0-beta.
|
|
3
|
+
"version": "4.3.0-beta.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@codemirror/lang-markdown": "^6.1.1",
|
|
46
46
|
"@codemirror/language-data": "^6.3.0",
|
|
47
47
|
"@types/markdown-it": "^12.2.3",
|
|
48
|
-
"@vavt/util": "^1.
|
|
48
|
+
"@vavt/util": "^1.2.0",
|
|
49
49
|
"codemirror": "^6.0.1",
|
|
50
50
|
"copy-to-clipboard": "^3.3.3",
|
|
51
51
|
"lru-cache": "^8.0.4",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var c=(o,t,s)=>t in o?u(o,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[t]=s;var p=(o,t,s)=>(c(o,typeof t!="symbol"?t+"":t,s),s);class a{constructor(){p(this,"pools",{})}remove(t,s,n){const i=this.pools[t]&&this.pools[t][s];i&&(this.pools[t][s]=i.filter(e=>e!==n))}clear(t){this.pools[t]={}}on(t,s){return this.pools[t]||(this.pools[t]={}),this.pools[t][s.name]||(this.pools[t][s.name]=[]),this.pools[t][s.name].push(s.callback),this.pools[t][s.name].includes(s.callback)}emit(t,s,...n){this.pools[t]||(this.pools[t]={});const i=this.pools[t][s];i&&i.forEach(e=>{try{e(...n)}catch(r){console.error(`${s} monitor event exception!`,r)}})}}const h=new a,g=(o,t="image.png")=>{const s=o.split(","),n=s[0].match(/:(.*?);/);if(n){const l=n[1],i=atob(s[1]);let e=i.length;const r=new Uint8Array(e);for(;e--;)r[e]=i.charCodeAt(e);return new File([r],t,{type:l})}return null},b=o=>{if(!o)return o;const t=o.split(`
|
|
2
|
-
`),s=['<span rn-wrapper aria-hidden="true">'];return t.forEach(()=>{s.push("<span></span>")}),s.push("</span>"),`<span class="code-block">${o}</span>${s.join("")}`},R=(o,t)=>{if(!o||!t)return 0;const s=o==null?void 0:o.getBoundingClientRect();if(t===document.documentElement)return s.top-t.clientTop;const n=t==null?void 0:t.getBoundingClientRect();return s.top-n.top},f=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`;exports.base642File=g;exports.bus=h;exports.generateCodeRowNumber=b;exports.getRelativeTop=R;exports.uuid=f;
|
package/lib/es/chunks/index4.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var a = Object.defineProperty;
|
|
2
|
-
var c = (o, t, s) => t in o ? a(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
|
|
3
|
-
var p = (o, t, s) => (c(o, typeof t != "symbol" ? t + "" : t, s), s);
|
|
4
|
-
class u {
|
|
5
|
-
constructor() {
|
|
6
|
-
// 事件池
|
|
7
|
-
p(this, "pools", {});
|
|
8
|
-
}
|
|
9
|
-
// 移除事件监听
|
|
10
|
-
remove(t, s, n) {
|
|
11
|
-
const i = this.pools[t] && this.pools[t][s];
|
|
12
|
-
i && (this.pools[t][s] = i.filter((r) => r !== n));
|
|
13
|
-
}
|
|
14
|
-
// 清空全部事件,由于单一实例,多次注册会被共享内容
|
|
15
|
-
clear(t) {
|
|
16
|
-
this.pools[t] = {};
|
|
17
|
-
}
|
|
18
|
-
// 注册事件监听
|
|
19
|
-
on(t, s) {
|
|
20
|
-
return this.pools[t] || (this.pools[t] = {}), this.pools[t][s.name] || (this.pools[t][s.name] = []), this.pools[t][s.name].push(s.callback), this.pools[t][s.name].includes(s.callback);
|
|
21
|
-
}
|
|
22
|
-
// 触发事件
|
|
23
|
-
emit(t, s, ...n) {
|
|
24
|
-
this.pools[t] || (this.pools[t] = {});
|
|
25
|
-
const i = this.pools[t][s];
|
|
26
|
-
i && i.forEach((r) => {
|
|
27
|
-
try {
|
|
28
|
-
r(...n);
|
|
29
|
-
} catch (l) {
|
|
30
|
-
console.error(`${s} monitor event exception!`, l);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const g = new u(), f = (o, t = "image.png") => {
|
|
36
|
-
const s = o.split(","), n = s[0].match(/:(.*?);/);
|
|
37
|
-
if (n) {
|
|
38
|
-
const e = n[1], i = atob(s[1]);
|
|
39
|
-
let r = i.length;
|
|
40
|
-
const l = new Uint8Array(r);
|
|
41
|
-
for (; r--; )
|
|
42
|
-
l[r] = i.charCodeAt(r);
|
|
43
|
-
return new File([l], t, { type: e });
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}, b = (o) => {
|
|
47
|
-
if (!o)
|
|
48
|
-
return o;
|
|
49
|
-
const t = o.split(`
|
|
50
|
-
`), s = ['<span rn-wrapper aria-hidden="true">'];
|
|
51
|
-
return t.forEach(() => {
|
|
52
|
-
s.push("<span></span>");
|
|
53
|
-
}), s.push("</span>"), `<span class="code-block">${o}</span>${s.join("")}`;
|
|
54
|
-
}, R = (o, t) => {
|
|
55
|
-
if (!o || !t)
|
|
56
|
-
return 0;
|
|
57
|
-
const s = o == null ? void 0 : o.getBoundingClientRect();
|
|
58
|
-
if (t === document.documentElement)
|
|
59
|
-
return s.top - t.clientTop;
|
|
60
|
-
const n = t == null ? void 0 : t.getBoundingClientRect();
|
|
61
|
-
return s.top - n.top;
|
|
62
|
-
}, m = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`;
|
|
63
|
-
export {
|
|
64
|
-
f as a,
|
|
65
|
-
g as b,
|
|
66
|
-
R as c,
|
|
67
|
-
b as g,
|
|
68
|
-
m as u
|
|
69
|
-
};
|