@ebl-vue/editor-render 2.31.25
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +129 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +1 -0
- package/dist/styles/alert.css +151 -0
- package/dist/styles/block-alignment.css +9 -0
- package/dist/styles/code.css +214 -0
- package/dist/styles/color.css +27 -0
- package/dist/styles/delimiter.css +14 -0
- package/dist/styles/header.css +20 -0
- package/dist/styles/image.css +156 -0
- package/dist/styles/indent.css +86 -0
- package/dist/styles/index.css +68 -0
- package/dist/styles/inline-code.css +11 -0
- package/dist/styles/list.css +202 -0
- package/dist/styles/marker.css +4 -0
- package/dist/styles/outline.css +52 -0
- package/dist/styles/paragraph.css +23 -0
- package/dist/styles/quote.css +26 -0
- package/dist/styles/table.css +388 -0
- package/dist/styles/underline.css +3 -0
- package/package.json +54 -0
- package/src/EditorRender.vue +43 -0
- package/src/components/List.vue +40 -0
- package/src/components/alert.vue +21 -0
- package/src/components/code.vue +114 -0
- package/src/components/delimiter.vue +19 -0
- package/src/components/h1.vue +19 -0
- package/src/components/h2.vue +19 -0
- package/src/components/h3.vue +19 -0
- package/src/components/h4.vue +19 -0
- package/src/components/h5.vue +19 -0
- package/src/components/h6.vue +19 -0
- package/src/components/image.vue +31 -0
- package/src/components/index.ts +54 -0
- package/src/components/paragraph.vue +19 -0
- package/src/components/quote.vue +21 -0
- package/src/components/table.vue +46 -0
- package/src/constants/index.ts +1 -0
- package/src/i18n/zh-cn.ts +158 -0
- package/src/icons/index.ts +93 -0
- package/src/index.ts +12 -0
- package/src/installer.ts +21 -0
- package/src/styles/alert.css +151 -0
- package/src/styles/block-alignment.css +9 -0
- package/src/styles/code.css +214 -0
- package/src/styles/color.css +27 -0
- package/src/styles/delimiter.css +14 -0
- package/src/styles/header.css +20 -0
- package/src/styles/image.css +156 -0
- package/src/styles/indent.css +86 -0
- package/src/styles/index.css +68 -0
- package/src/styles/inline-code.css +11 -0
- package/src/styles/list.css +202 -0
- package/src/styles/marker.css +4 -0
- package/src/styles/outline.css +52 -0
- package/src/styles/paragraph.css +23 -0
- package/src/styles/quote.css +26 -0
- package/src/styles/table.css +388 -0
- package/src/styles/underline.css +3 -0
- package/src/types.ts +5 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/install.ts +19 -0
- package/tsconfig.json +37 -0
- package/types/index.d.ts +19 -0
- package/vite.config.ts +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ebl-vue
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
|
|
3
|
+
export declare interface IBlock {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
data: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export declare const install: (app: App) => void;
|
|
10
|
+
|
|
11
|
+
declare const installer: {
|
|
12
|
+
version: string;
|
|
13
|
+
install: (app: App) => void;
|
|
14
|
+
};
|
|
15
|
+
export default installer;
|
|
16
|
+
|
|
17
|
+
export declare const version: string;
|
|
18
|
+
|
|
19
|
+
export { }
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineComponent as d, openBlock as s, createElementBlock as i, Fragment as k, renderList as b, createElementVNode as n, normalizeClass as f, normalizeStyle as _, createBlock as N, resolveDynamicComponent as D, useModel as u, isRef as O, shallowRef as E, ref as S, watchEffect as Y, computed as R, unref as $, toDisplayString as G, createStaticVNode as F, createCommentVNode as w } from "vue";
|
|
2
|
+
import { codeToHtml as K } from "shiki";
|
|
3
|
+
const V = Symbol("INSTALLED_KEY"), P = (t, e) => {
|
|
4
|
+
if (t.install = (l) => {
|
|
5
|
+
for (const a of [t, ...Object.values(e != null ? e : {})])
|
|
6
|
+
l.component(a.name, a);
|
|
7
|
+
}, e)
|
|
8
|
+
for (const [l, a] of Object.entries(e))
|
|
9
|
+
t[l] = a;
|
|
10
|
+
return t;
|
|
11
|
+
}, Z = { class: "ebl-editor-render" }, J = ["data-id"], Q = d({ name: "EblEditorRender", inheritAttrs: !1, __name: "EditorRender", props: { data: { default: () => ({ blocks: [] }) }, locale: { default: {} } }, setup: (t) => (e, l) => (s(), i("div", Z, [(s(!0), i(k, null, b(e.data.blocks, (a) => (s(), i("div", { class: "ce-block", "data-id": a.id }, [n("div", { class: f(`ce-tune-alignment--${a.tunes.blockAlignment.alignment}`) }, [n("div", { style: _(`padding-left: ${48 * a.tunes.indent.indentLevel}px;`) }, [(s(), N(D("ebl" + a.type), { block: a }, null, 8, ["block"]))], 4)], 2)], 8, J))), 256)), l[0] || (l[0] = n("div", { class: "ebl-outline" }, [n("div", { style: { height: "5000px" } }, " dd ")], -1))])) }), U = ["innerHTML"], X = d({ name: "eblparagraph", inheritAttrs: !1, __name: "paragraph", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
12
|
+
const e = u(t, "block");
|
|
13
|
+
return (l, a) => (s(), i("div", { class: "ce-paragraph cdx-block", innerHTML: e.value.data.text }, null, 8, U));
|
|
14
|
+
} }), ee = ["innerHTML"], te = d({ name: "eblh1", inheritAttrs: !1, __name: "h1", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
15
|
+
const e = u(t, "block");
|
|
16
|
+
return (l, a) => (s(), i("h1", { class: "ce-header", innerHTML: e.value.data.text }, null, 8, ee));
|
|
17
|
+
} }), ae = ["innerHTML"], le = d({ name: "eblh2", inheritAttrs: !1, __name: "h2", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
18
|
+
const e = u(t, "block");
|
|
19
|
+
return (l, a) => (s(), i("h2", { class: "ce-header", innerHTML: e.value.data.text }, null, 8, ae));
|
|
20
|
+
} }), se = ["innerHTML"], ie = d({ name: "eblh3", inheritAttrs: !1, __name: "h3", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
21
|
+
const e = u(t, "block");
|
|
22
|
+
return (l, a) => (s(), i("h3", { class: "ce-header", innerHTML: e.value.data.text }, null, 8, se));
|
|
23
|
+
} }), ne = ["innerHTML"], oe = d({ name: "eblh4", inheritAttrs: !1, __name: "h4", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
24
|
+
const e = u(t, "block");
|
|
25
|
+
return (l, a) => (s(), i("h4", { class: "ce-header", innerHTML: e.value.data.text }, null, 8, ne));
|
|
26
|
+
} }), ce = ["innerHTML"], re = d({ name: "eblh5", inheritAttrs: !1, __name: "h5", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
27
|
+
const e = u(t, "block");
|
|
28
|
+
return (l, a) => (s(), i("h5", { class: "ce-header", innerHTML: e.value.data.text }, null, 8, ce));
|
|
29
|
+
} }), de = ["innerHTML"], ue = d({ name: "eblh6", inheritAttrs: !1, __name: "h6", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
30
|
+
const e = u(t, "block");
|
|
31
|
+
return (l, a) => (s(), i("h6", { class: "ce-header", innerHTML: e.value.data.text }, null, 8, de));
|
|
32
|
+
} }), pe = ["innerHTML"], me = d({ name: "eblalert", inheritAttrs: !1, __name: "alert", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
33
|
+
const e = u(t, "block");
|
|
34
|
+
return (l, a) => (s(), i("div", { class: f(`cdx-alert cdx-alert-${e.value.data.type} cdx-alert-align-${e.value.data.align}`) }, [n("div", { class: "cdx-alert__message", innerHTML: e.value.data.message }, null, 8, pe)], 2));
|
|
35
|
+
} });
|
|
36
|
+
const he = () => {
|
|
37
|
+
}, ke = { class: "ce-editorjs-x-shiki__selector" }, ve = { class: "ce-editorjs-x-shiki__lang" }, be = { class: "ce-editorjs-x-shiki__copy", ref: "copyRef" }, _e = ["innerHTML"], fe = d({ name: "eblcode", inheritAttrs: !1, __name: "code", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
38
|
+
const e = S(null), l = u(t, "block"), a = function(r, m, o) {
|
|
39
|
+
let p;
|
|
40
|
+
p = O(o) ? { evaluating: o } : o || {};
|
|
41
|
+
const { lazy: x = !1, flush: y = "pre", evaluating: h, shallow: M = !0, onError: L = he } = p, v = E(!x), H = M ? E(m) : S(m);
|
|
42
|
+
let g = 0;
|
|
43
|
+
return Y(async (B) => {
|
|
44
|
+
if (!v.value)
|
|
45
|
+
return;
|
|
46
|
+
g++;
|
|
47
|
+
const A = g;
|
|
48
|
+
let j = !1;
|
|
49
|
+
h && Promise.resolve().then(() => {
|
|
50
|
+
h.value = !0;
|
|
51
|
+
});
|
|
52
|
+
try {
|
|
53
|
+
const T = await r((I) => {
|
|
54
|
+
B(() => {
|
|
55
|
+
h && (h.value = !1), j || I();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
A === g && (H.value = T);
|
|
59
|
+
} catch (T) {
|
|
60
|
+
L(T);
|
|
61
|
+
} finally {
|
|
62
|
+
h && A === g && (h.value = !1), j = !0;
|
|
63
|
+
}
|
|
64
|
+
}, { flush: y }), x ? R(() => (v.value = !0, H.value)) : H;
|
|
65
|
+
}(async () => {
|
|
66
|
+
let r = "";
|
|
67
|
+
return { html: await K(l.value.data.code, { lang: l.value.data.lang, theme: l.value.data.theme || "github-dark-dimmed", transformers: [{ preprocess: (o) => `${o}
|
|
68
|
+
`, pre(o) {
|
|
69
|
+
var p;
|
|
70
|
+
this.addClassToHast(o, "ce-editorjs-x-shiki__span"), r = ((p = o.properties) == null ? void 0 : p.style) || "";
|
|
71
|
+
}, line(o, p) {
|
|
72
|
+
o.properties = o.properties || {}, o.properties["data-line"] = p;
|
|
73
|
+
} }] }), preStyle: r };
|
|
74
|
+
});
|
|
75
|
+
function c(r) {
|
|
76
|
+
e.value && function(m, o) {
|
|
77
|
+
let p = o.clientY, x = parseInt(window.getComputedStyle(m).height, 10);
|
|
78
|
+
const y = (M) => {
|
|
79
|
+
const L = M.clientY - p;
|
|
80
|
+
let v = x + L;
|
|
81
|
+
v < 100 && (v = 100), m.style.height = v + "px";
|
|
82
|
+
}, h = () => {
|
|
83
|
+
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", h);
|
|
84
|
+
};
|
|
85
|
+
document.addEventListener("mousemove", y), document.addEventListener("mouseup", h);
|
|
86
|
+
}(e.value, r);
|
|
87
|
+
}
|
|
88
|
+
return (r, m) => {
|
|
89
|
+
var o, p;
|
|
90
|
+
return s(), i("div", { class: f("cdx-block ce-editorjs-x-shiki"), style: _(`${(o = $(a)) == null ? void 0 : o.preStyle}`) }, [n("div", ke, [n("div", ve, G(l.value.data.lang), 1), n("div", be, [...m[0] || (m[0] = [F('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" data-v-c4c07368><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.25 8.5H10.25C9.2835 8.5 8.5 9.2835 8.5 10.25V17.25C8.5 18.2165 9.2835 19 10.25 19H17.25C18.2165 19 19 18.2165 19 17.25V10.25C19 9.2835 18.2165 8.5 17.25 8.5Z" data-v-c4c07368></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.5 8.5V6.75C15.5 6.28587 15.3156 5.84075 14.9874 5.51256C14.6592 5.18437 14.2141 5 13.75 5H6.75C6.28587 5 5.84075 5.18437 5.51256 5.51256C5.18437 5.84075 5 6.28587 5 6.75V13.75C5 14.2141 5.18437 14.6592 5.51256 14.9874C5.84075 15.3156 6.28587 15.5 6.75 15.5H8.5" data-v-c4c07368></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 12L15.5 12" data-v-c4c07368></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15.5L15.5 15.5" data-v-c4c07368></path></svg><div class="ce-editorjs-x-shiki__copy_tip" data-v-c4c07368>已复制</div>', 2)])], 512)]), n("div", { ref_key: "codeRef", ref: e, class: "ce-editorjs-x-shiki__code", style: _(`height:${l.value.data.resizeSize}px`) }, [n("span", { innerHTML: (p = $(a)) == null ? void 0 : p.html }, null, 8, _e)], 4), n("div", { class: "ce-editorjs-x-shiki__code__dragHandler", onMousedown: c }, null, 32)], 4);
|
|
91
|
+
};
|
|
92
|
+
} }), C = (t, e) => {
|
|
93
|
+
const l = t.__vccOpts || t;
|
|
94
|
+
for (const [a, c] of e)
|
|
95
|
+
l[a] = c;
|
|
96
|
+
return l;
|
|
97
|
+
}, xe = C(fe, [["__scopeId", "data-v-c4c07368"]]), ye = { class: "ce-delimiter cdx-block" }, ge = d({ name: "ebldelimiter", inheritAttrs: !1, __name: "delimiter", setup: (t) => (e, l) => (s(), i("div", ye, [...l[0] || (l[0] = [n("div", { class: "ce-delimiter__line__wrapper" }, [n("div", { class: "ce-delimiter__line" })], -1)])])) }), Me = { key: 0, class: "cdx-list cdx-list-unordered" }, Le = ["innerHTML"], He = ["innerHTML"], Te = { key: 2, class: "cdx-list cdx-list-checklist" }, we = ["innerHTML"], Ce = d({ name: "eblList", inheritAttrs: !1, __name: "List", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
98
|
+
const e = u(t, "block");
|
|
99
|
+
return (l, a) => (s(), i(k, null, [e.value.data.style === "unordered" ? (s(), i("ul", Me, [(s(!0), i(k, null, b(e.value.data.items, (c, r) => (s(), i("li", { class: "cdx-list__item", key: r }, [n("div", { class: "cdx-list__item-content", innerHTML: c.content }, null, 8, Le)]))), 128))])) : w("", !0), e.value.data.style === "ordered" ? (s(), i("ol", { key: 1, class: "cdx-list cdx-list-ordered", style: _(`--list-counter-type: ${e.value.data.meta.counterType};`) }, [(s(!0), i(k, null, b(e.value.data.items, (c, r) => (s(), i("li", { class: "cdx-list__item", key: r }, [n("div", { class: "cdx-list__item-content", innerHTML: c.content }, null, 8, He)]))), 128))], 4)) : w("", !0), e.value.data.style === "checklist" ? (s(), i("ul", Te, [(s(!0), i(k, null, b(e.value.data.items, (c, r) => (s(), i("li", { class: "cdx-list__item", key: r }, [n("div", { class: f(["cdx-list__checkbox cdx-list__checkbox-check--disabled", { "cdx-list__checkbox--checked": c.meta.checked }]) }, [...a[0] || (a[0] = [n("span", { class: "cdx-list__checkbox-check" }, [n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24" }, [n("path", { stroke: "currentColor", "stroke-linecap": "round", "stroke-width": "2", d: "M7 12L10.4884 15.8372C10.5677 15.9245 10.705 15.9245 10.7844 15.8372L17 9" })])], -1)])], 2), n("div", { class: "cdx-list__item-content", innerHTML: c.content }, null, 8, we)]))), 128))])) : w("", !0)], 64));
|
|
100
|
+
} }), Ae = { class: "cdx-block cdx-quote" }, je = ["innerHTML"], Ee = { class: "tc-row" }, Se = ["innerHTML"], $e = { class: "cdx-block image-tool image-tool--filled" }, Ve = { class: "image-tool__image" }, qe = ["src"], q = [Q, X, te, le, ie, oe, re, ue, me, xe, ge, Ce, d({ name: "eblquote", inheritAttrs: !1, __name: "quote", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
101
|
+
const e = u(t, "block");
|
|
102
|
+
return (l, a) => (s(), i("div", Ae, [n("blockquote", { class: "cdx-input cdx-quote__text cdx-block-quote", innerHTML: e.value.data.text }, null, 8, je)]));
|
|
103
|
+
} }), C(d({ name: "ebltable", inheritAttrs: !1, __name: "table", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
104
|
+
const e = u(t, "block"), l = R(() => {
|
|
105
|
+
let a = "";
|
|
106
|
+
if (e.value.data.colWidth && e.value.data.colWidth.length > 0)
|
|
107
|
+
for (let c = 0; c < e.value.data.colWidth.length; c++)
|
|
108
|
+
a += " " + e.value.data.colWidth[c] + "px";
|
|
109
|
+
return a ? { "--col-width": a } : {};
|
|
110
|
+
});
|
|
111
|
+
return (a, c) => (s(), i("div", { class: "tc-wrap tc-wrap--readonly", style: _(l.value) }, [n("div", { class: f(["tc-table", { "tc-table--heading": e.value.data.withHeadings }]) }, [(s(!0), i(k, null, b(e.value.data.content, (r) => (s(), i("div", Ee, [(s(!0), i(k, null, b(r, (m) => (s(), i("div", { class: "tc-cell", innerHTML: m }, null, 8, Se))), 256))]))), 256))], 2)], 4));
|
|
112
|
+
} }), [["__scopeId", "data-v-0627102b"]]), C(d({ name: "eblimage", inheritAttrs: !1, __name: "image", props: { block: { default: { id: "", type: "", data: {} } }, blockModifiers: {} }, emits: ["update:block"], setup(t) {
|
|
113
|
+
const e = u(t, "block");
|
|
114
|
+
return (l, a) => (s(), i("div", $e, [n("div", Ve, [n("img", { class: "image-tool__image-picture", src: e.value.data.file.url }, null, 8, qe)]), a[0] || (a[0] = n("div", { class: "cdx-input image-tool__caption", contenteditable: "true", "data-placeholder": "Caption", "data-empty": "true" }, null, -1))]));
|
|
115
|
+
} }), [["__scopeId", "data-v-f7e9c352"]])];
|
|
116
|
+
let W = [];
|
|
117
|
+
for (let t in q) {
|
|
118
|
+
const e = P(q[t]);
|
|
119
|
+
W.push(e);
|
|
120
|
+
}
|
|
121
|
+
const z = ((t = []) => ({ version: "2.31.25", install: (e) => {
|
|
122
|
+
e[V] || (e[V] = !0, t.forEach((l) => e.use(l)));
|
|
123
|
+
} }))(W), ze = z.install, Be = z.version;
|
|
124
|
+
export {
|
|
125
|
+
z as default,
|
|
126
|
+
ze as install,
|
|
127
|
+
Be as version
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=index.mjs.map
|