geekplus-digital-ui 0.1.28 → 0.1.30
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/components/editor/index.d.ts +1 -1
- package/components/editor/src/editor.vue.d.ts +1 -1
- package/components/editor/src/editor.vue.js +72 -68
- package/components/editor/src/editor2.css +1 -1
- package/components/editor/src/table-width.d.ts +1 -0
- package/components/editor/src/table-width.js +63 -0
- package/package.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { i18nChangeLanguage as
|
|
3
|
-
import { Toolbar as
|
|
1
|
+
import { ref as a, computed as s, createApp as W, watch as h, nextTick as G, onBeforeUnmount as J, openBlock as x, createElementBlock as K, normalizeClass as Q, withDirectives as X, createVNode as I, unref as y, vShow as Y, normalizeStyle as Z, createBlock as _, createCommentVNode as ee } from "vue";
|
|
2
|
+
import { i18nChangeLanguage as te } from "@wangeditor-next/editor";
|
|
3
|
+
import { Toolbar as oe, Editor as le } from "@wangeditor-next/editor-for-vue";
|
|
4
4
|
import './editor2.css';import './editor.css';/* empty css */
|
|
5
5
|
import "../../../hooks/index.js";
|
|
6
|
-
import { useFormItem as
|
|
7
|
-
import
|
|
6
|
+
import { useFormItem as ae, ElImageViewer as ne } from "element-plus";
|
|
7
|
+
import re from "./code-collapse.vue.js";
|
|
8
|
+
import { normalizeTableColumnWidths as B } from "./table-width.js";
|
|
8
9
|
/* empty css */
|
|
9
|
-
import
|
|
10
|
-
import { useLocale as
|
|
11
|
-
const
|
|
10
|
+
import ie from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
11
|
+
import { useLocale as de } from "../../../hooks/use-locale/index.js";
|
|
12
|
+
const ce = /* @__PURE__ */ Object.assign({
|
|
12
13
|
name: "DEditor"
|
|
13
14
|
}, {
|
|
14
15
|
__name: "editor",
|
|
@@ -47,107 +48,110 @@ const re = /* @__PURE__ */ Object.assign({
|
|
|
47
48
|
},
|
|
48
49
|
placeholder: String
|
|
49
50
|
},
|
|
50
|
-
emits: ["
|
|
51
|
-
setup(
|
|
52
|
-
const o =
|
|
51
|
+
emits: ["update:model-value"],
|
|
52
|
+
setup(n, { emit: S }) {
|
|
53
|
+
const o = n, N = S, z = a(null), r = a(null), V = a(""), u = a(""), m = a(null), E = a(0), f = a(!1), p = a([]), g = a(0), v = /* @__PURE__ */ new Map(), { t: A, getLocale: R } = de(), { formItem: k } = ae(), T = s(() => R()), L = (e) => {
|
|
53
54
|
r.value = Object.seal(e);
|
|
54
|
-
}, L = (e) => {
|
|
55
|
-
let t = e;
|
|
56
|
-
t === "<p><br></p>" && (t = ""), t !== h.value && (h.value = t, V("update:model-value", t), E?.validate("change"), E?.validate("blur"));
|
|
57
55
|
}, O = (e) => {
|
|
56
|
+
let t = e;
|
|
57
|
+
t === "<p><br></p>" && (t = "");
|
|
58
|
+
const l = B(t);
|
|
59
|
+
l !== u.value && (m.value = l, u.value = l, N("update:model-value", l), k?.validate("change"), k?.validate("blur"));
|
|
60
|
+
}, j = (e) => {
|
|
58
61
|
if (!o.disabled)
|
|
59
62
|
return;
|
|
60
63
|
const t = e?.target?.closest?.("img");
|
|
61
64
|
if (!t)
|
|
62
65
|
return;
|
|
63
|
-
const
|
|
66
|
+
const l = r.value?.getEditableContainer?.(), i = Array.from(l?.querySelectorAll?.("img") || []);
|
|
64
67
|
if (i.length === 0)
|
|
65
68
|
return;
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
69
|
+
const b = (d) => d?.currentSrc || d?.src || d?.getAttribute?.("data-src") || "", C = i.map(b).filter(Boolean);
|
|
70
|
+
if (C.length === 0)
|
|
68
71
|
return;
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
+
const F = b(t), w = C.findIndex((d) => d === F);
|
|
73
|
+
p.value = C, g.value = w >= 0 ? w : 0, f.value = !0, e?.stopPropagation?.();
|
|
74
|
+
}, U = (e) => {
|
|
72
75
|
if (o.disabled) {
|
|
73
|
-
|
|
76
|
+
j(e);
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
76
79
|
r.value?.focus?.();
|
|
77
|
-
},
|
|
78
|
-
|
|
80
|
+
}, D = () => {
|
|
81
|
+
f.value = !1, p.value = [], g.value = 0;
|
|
79
82
|
}, c = () => {
|
|
80
|
-
|
|
81
|
-
t?.isConnected &&
|
|
82
|
-
}),
|
|
83
|
-
},
|
|
83
|
+
v.forEach(({ app: e, host: t, pre: l }) => {
|
|
84
|
+
t?.isConnected && l?.isConnected && t.parentNode && t.parentNode.insertBefore(l, t), e.unmount(), t?.remove();
|
|
85
|
+
}), v.clear();
|
|
86
|
+
}, H = (e) => {
|
|
84
87
|
const t = document.createElement("div");
|
|
85
88
|
e.parentNode?.insertBefore(t, e);
|
|
86
|
-
const
|
|
87
|
-
(i.contentRef?.value || i.contentRef)?.appendChild(e),
|
|
88
|
-
app:
|
|
89
|
+
const l = W(re), i = l.mount(t);
|
|
90
|
+
(i.contentRef?.value || i.contentRef)?.appendChild(e), v.set(e, {
|
|
91
|
+
app: l,
|
|
89
92
|
host: t,
|
|
90
93
|
pre: e
|
|
91
94
|
});
|
|
92
|
-
},
|
|
95
|
+
}, q = () => {
|
|
93
96
|
const e = r.value?.getEditableContainer?.()?.querySelectorAll("pre");
|
|
94
97
|
e && e.forEach((t) => {
|
|
95
|
-
t.parentElement?.tagName !== "DETAILS" &&
|
|
98
|
+
t.parentElement?.tagName !== "DETAILS" && H(t);
|
|
96
99
|
});
|
|
97
|
-
},
|
|
100
|
+
}, M = s(() => ({
|
|
98
101
|
...o.toolbarConfig
|
|
99
|
-
})),
|
|
100
|
-
placeholder: o.disabled ? "" : o.placeholder ||
|
|
102
|
+
})), P = s(() => ({
|
|
103
|
+
placeholder: o.disabled ? "" : o.placeholder || A("d.editor.placeholder"),
|
|
101
104
|
readOnly: o.disabled,
|
|
102
105
|
...o.editorConfig
|
|
103
|
-
})),
|
|
104
|
-
"--minHeight": o.
|
|
106
|
+
})), $ = s(() => ({
|
|
107
|
+
"--minHeight": o.disabled ? "" : `${o.minHeight}px`
|
|
105
108
|
}));
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
}, { immediate: !0 }),
|
|
109
|
-
c(),
|
|
110
|
-
}),
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
return h(T, (e) => {
|
|
110
|
+
te(e === "zh-cn" ? "zh-CN" : "en");
|
|
111
|
+
}, { immediate: !0 }), h(() => o.disabled, () => {
|
|
112
|
+
c(), E.value++;
|
|
113
|
+
}), h(() => o.modelValue, () => {
|
|
114
|
+
const e = B(o.modelValue);
|
|
115
|
+
u.value = e, m.value === o.modelValue ? m.value = null : V.value = e, o.disabled ? G(() => {
|
|
116
|
+
c(), q();
|
|
113
117
|
}) : c();
|
|
114
|
-
}, { immediate: !0 }),
|
|
118
|
+
}, { immediate: !0 }), J(() => {
|
|
115
119
|
c(), r.value?.destroy?.();
|
|
116
|
-
}), (e, t) => (
|
|
120
|
+
}), (e, t) => (x(), K("div", {
|
|
117
121
|
ref_key: "rootRef",
|
|
118
|
-
ref:
|
|
119
|
-
key:
|
|
120
|
-
class:
|
|
122
|
+
ref: z,
|
|
123
|
+
key: E.value,
|
|
124
|
+
class: Q(["d-editor", { "editor-border": n.border, "editor-disabled": n.disabled }])
|
|
121
125
|
}, [
|
|
122
|
-
|
|
126
|
+
X(I(y(oe), {
|
|
123
127
|
class: "toolbar-container",
|
|
124
128
|
editor: r.value,
|
|
125
|
-
"default-config":
|
|
126
|
-
mode:
|
|
129
|
+
"default-config": M.value,
|
|
130
|
+
mode: n.mode
|
|
127
131
|
}, null, 8, ["editor", "default-config", "mode"]), [
|
|
128
|
-
[
|
|
132
|
+
[Y, n.showToolbar && !n.disabled]
|
|
129
133
|
]),
|
|
130
|
-
|
|
134
|
+
I(y(le), {
|
|
131
135
|
class: "editor-container",
|
|
132
|
-
style:
|
|
133
|
-
"model-value":
|
|
134
|
-
"default-config":
|
|
135
|
-
mode:
|
|
136
|
-
onOnCreated:
|
|
137
|
-
"onUpdate:modelValue":
|
|
138
|
-
onClick:
|
|
136
|
+
style: Z($.value),
|
|
137
|
+
"model-value": V.value,
|
|
138
|
+
"default-config": P.value,
|
|
139
|
+
mode: n.mode,
|
|
140
|
+
onOnCreated: L,
|
|
141
|
+
"onUpdate:modelValue": O,
|
|
142
|
+
onClick: U
|
|
139
143
|
}, null, 8, ["style", "model-value", "default-config", "mode"]),
|
|
140
|
-
|
|
144
|
+
f.value ? (x(), _(y(ne), {
|
|
141
145
|
key: 0,
|
|
142
|
-
"url-list":
|
|
143
|
-
"initial-index":
|
|
146
|
+
"url-list": p.value,
|
|
147
|
+
"initial-index": g.value,
|
|
144
148
|
"hide-on-click-modal": "",
|
|
145
149
|
teleported: "",
|
|
146
|
-
onClose:
|
|
147
|
-
}, null, 8, ["url-list", "initial-index"])) :
|
|
150
|
+
onClose: D
|
|
151
|
+
}, null, 8, ["url-list", "initial-index"])) : ee("", !0)
|
|
148
152
|
], 2));
|
|
149
153
|
}
|
|
150
|
-
}),
|
|
154
|
+
}), Ve = /* @__PURE__ */ ie(ce, [["__scopeId", "data-v-f8d9c2e5"]]);
|
|
151
155
|
export {
|
|
152
|
-
|
|
156
|
+
Ve as default
|
|
153
157
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.d-editor[data-v-
|
|
1
|
+
.d-editor[data-v-f8d9c2e5]{width:100%}.d-editor.w-e-full-screen-container[data-v-f8d9c2e5]{z-index:1000}.d-editor .toolbar-container[data-v-f8d9c2e5]{border-bottom:1px solid var(--el-border-color)}.d-editor .toolbar-container[data-v-f8d9c2e5] .w-e-toolbar{border-radius:4px}.d-editor .toolbar-container[data-v-f8d9c2e5] .w-e-drop-panel{z-index:100}.d-editor .editor-container[data-v-f8d9c2e5]{min-height:var(--minHeight);background:var(--el-fill-color-blank);border-radius:4px}.d-editor .editor-container[data-v-f8d9c2e5] p[id^=w-e-element-paragraph-]{margin:10px 0}.d-editor .editor-container[data-v-f8d9c2e5] .w-e-text-placeholder{font-style:normal;font-size:14px;line-height:normal;top:11px}.d-editor .editor-container[data-v-f8d9c2e5] .w-e-image-container{width:500px}.d-editor .editor-container[data-v-f8d9c2e5] pre :deep(code){text-shadow:none}.d-editor.editor-disabled[data-v-f8d9c2e5]:not(.editor-border) div[id^=w-e-textarea-]{padding:0}.d-editor.editor-disabled[data-v-f8d9c2e5]:not(.editor-border) p[id^=w-e-element-paragraph-]:first-child{margin-top:0}.d-editor.editor-disabled[data-v-f8d9c2e5]:not(.editor-border) p[id^=w-e-element-paragraph-]:last-child{margin-bottom:0}.editor-border[data-v-f8d9c2e5]{border:1px solid var(--el-border-color);border-radius:4px;background:var(--el-bg-color);transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.editor-border[data-v-f8d9c2e5]:hover{border-color:var(--el-text-color-disabled)}.editor-disabled .editor-container[data-v-f8d9c2e5] img{cursor:zoom-in}.el-form-item.is-error .editor-border[data-v-f8d9c2e5]{border:1px solid var(--el-color-danger)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function normalizeTableColumnWidths(html: any): any;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const d = /<table[\s>]/i, h = /<col(?:group)?[\s>]/i, p = /* @__PURE__ */ new Set(["TD", "TH"]), g = (t) => d.test(t) && h.test(t), l = (t) => {
|
|
2
|
+
if (t == null)
|
|
3
|
+
return "";
|
|
4
|
+
const e = `${t}`.trim();
|
|
5
|
+
return !e || e === "auto" ? "" : /^\d+(?:\.\d+)?$/.test(e) ? `${e}px` : e;
|
|
6
|
+
}, a = (t) => {
|
|
7
|
+
const e = l(t);
|
|
8
|
+
if (!e)
|
|
9
|
+
return null;
|
|
10
|
+
const r = Number.parseFloat(e);
|
|
11
|
+
return Number.isFinite(r) ? r : null;
|
|
12
|
+
}, A = (t) => t ? l(
|
|
13
|
+
t.getAttribute("width") || t.style?.width || t.getAttribute("data-width")
|
|
14
|
+
) : "", c = (t, e) => {
|
|
15
|
+
if (!t || !e)
|
|
16
|
+
return !1;
|
|
17
|
+
let r = !1;
|
|
18
|
+
t.style.width !== e && (t.style.width = e, r = !0);
|
|
19
|
+
const n = a(e);
|
|
20
|
+
if (n != null) {
|
|
21
|
+
const s = `${n}`;
|
|
22
|
+
t.getAttribute("width") !== s && (t.setAttribute("width", s), r = !0);
|
|
23
|
+
}
|
|
24
|
+
return r;
|
|
25
|
+
}, b = (t) => {
|
|
26
|
+
if (t.length === 0)
|
|
27
|
+
return "";
|
|
28
|
+
if (t.length === 1)
|
|
29
|
+
return t[0];
|
|
30
|
+
const e = t.map(a);
|
|
31
|
+
return e.every((r) => r != null) ? `${e.reduce((r, n) => r + n, 0)}px` : t[0];
|
|
32
|
+
}, y = (t) => {
|
|
33
|
+
const e = Array.from(t.querySelectorAll("colgroup col"));
|
|
34
|
+
if (e.length === 0)
|
|
35
|
+
return !1;
|
|
36
|
+
const r = e.map(A);
|
|
37
|
+
if (r.every((o) => !o))
|
|
38
|
+
return !1;
|
|
39
|
+
let n = !1;
|
|
40
|
+
e.forEach((o, u) => {
|
|
41
|
+
n = c(o, r[u]) || n;
|
|
42
|
+
});
|
|
43
|
+
const s = t.querySelector("tr");
|
|
44
|
+
if (!s)
|
|
45
|
+
return n;
|
|
46
|
+
let i = 0;
|
|
47
|
+
return Array.from(s.children).filter((o) => p.has(o.tagName)).forEach((o) => {
|
|
48
|
+
const u = Number.parseInt(o.getAttribute("colspan") || "1", 10) || 1, f = r.slice(i, i + u).filter(Boolean);
|
|
49
|
+
n = c(o, b(f)) || n, i += u;
|
|
50
|
+
}), n;
|
|
51
|
+
}, T = (t) => {
|
|
52
|
+
if (!t || typeof t != "string" || !g(t) || typeof document > "u")
|
|
53
|
+
return t;
|
|
54
|
+
const e = document.createElement("template");
|
|
55
|
+
e.innerHTML = t;
|
|
56
|
+
let r = !1;
|
|
57
|
+
return e.content.querySelectorAll("table").forEach((n) => {
|
|
58
|
+
r = y(n) || r;
|
|
59
|
+
}), r ? e.innerHTML : t;
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
T as normalizeTableColumnWidths
|
|
63
|
+
};
|