geekplus-digital-ui 0.1.36 → 0.1.38
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.d-editor[data-v-e54f6c52]{width:100%}.d-editor.w-e-full-screen-container[data-v-e54f6c52]{z-index:1000}.d-editor .toolbar-container[data-v-e54f6c52]{border-bottom:1px solid var(--el-border-color)}.d-editor .toolbar-container[data-v-e54f6c52] .w-e-toolbar{border-radius:4px}.d-editor .toolbar-container[data-v-e54f6c52] .w-e-drop-panel{z-index:100}.d-editor .editor-container[data-v-e54f6c52]{min-height:var(--minHeight);background:var(--el-fill-color-blank);border-radius:4px}.d-editor .editor-container[data-v-e54f6c52] p[id^=w-e-element-paragraph-]{margin:10px 0}.d-editor .editor-container[data-v-e54f6c52] .w-e-text-placeholder{font-size:14px;font-style:normal;line-height:normal;top:11px}.d-editor .editor-container[data-v-e54f6c52] .w-e-image-container{width:500px}.d-editor .editor-container[data-v-e54f6c52] pre code{text-shadow:none}.d-editor.editor-disabled[data-v-e54f6c52]:not(.editor-border) div[id^=w-e-textarea-]{padding:0}.d-editor.editor-disabled[data-v-e54f6c52]:not(.editor-border) p[id^=w-e-element-paragraph-]:first-child{margin-top:0}.d-editor.editor-disabled[data-v-e54f6c52]:not(.editor-border) p[id^=w-e-element-paragraph-]:last-child{margin-bottom:0}.editor-border[data-v-e54f6c52]{border:1px solid var(--el-border-color);background:var(--el-bg-color);border-radius:4px;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.editor-border[data-v-e54f6c52]:hover{border-color:var(--el-text-color-disabled)}.editor-disabled .editor-container[data-v-e54f6c52] img{cursor:zoom-in}.el-form-item.is-error .editor-border[data-v-e54f6c52]{border:1px solid var(--el-color-danger)}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useLocale as e } from "../../../hooks/use-locale/index.js";
|
|
2
2
|
import "../../../hooks/index.js";
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
import './editor.
|
|
4
|
+
import './editor.vue_vue_type_style_index_0_scoped_e54f6c52_lang.css';import './editor.css';/* empty css */
|
|
5
5
|
import n from "./code-collapse.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import { computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createVNode as c, nextTick as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, openBlock as p, ref as m, unref as h, vShow as g, watch as _, withDirectives as
|
|
8
|
-
import { ElImageViewer as
|
|
9
|
-
import { i18nChangeLanguage as
|
|
10
|
-
import { Editor as
|
|
11
|
-
|
|
7
|
+
import { computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createVNode as c, nextTick as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, openBlock as p, ref as m, unref as h, vShow as g, watch as _, withDirectives as ee } from "vue";
|
|
8
|
+
import { ElImageViewer as v, useFormItem as y } from "element-plus";
|
|
9
|
+
import { i18nChangeLanguage as b } from "@wangeditor-next/editor";
|
|
10
|
+
import { Editor as x, Toolbar as S } from "@wangeditor-next/editor-for-vue";
|
|
11
|
+
//#region packages/components/editor/src/editor.vue
|
|
12
|
+
var C = "<p><br></p>", w = /* @__PURE__ */ t(/* @__PURE__ */ Object.assign({ name: "DEditor" }, {
|
|
12
13
|
__name: "editor",
|
|
13
14
|
props: {
|
|
14
15
|
modelValue: {
|
|
@@ -47,7 +48,7 @@ var w = /* @__PURE__ */ t(/* @__PURE__ */ Object.assign({ name: "DEditor" }, {
|
|
|
47
48
|
},
|
|
48
49
|
emits: ["update:model-value"],
|
|
49
50
|
setup(t, { expose: w, emit: T }) {
|
|
50
|
-
let E = t, D = T, O = m(null), k = m(""), A = m(""), j = m(null), M = m(!1),
|
|
51
|
+
let E = t, D = T, O = m(null), k = m(""), A = m(""), j = m(null), M = m(0), N = m(!1), P = m([]), F = m(0), I = /* @__PURE__ */ new Map(), { t: L, getLocale: R } = e(), { formItem: z } = y(), B = r(() => R()), V = /[\s\u00A0\u200B-\u200D\uFEFF]/g, H = [
|
|
51
52
|
"img",
|
|
52
53
|
"video",
|
|
53
54
|
"audio",
|
|
@@ -59,122 +60,130 @@ var w = /* @__PURE__ */ t(/* @__PURE__ */ Object.assign({ name: "DEditor" }, {
|
|
|
59
60
|
"table",
|
|
60
61
|
"pre",
|
|
61
62
|
"hr"
|
|
62
|
-
],
|
|
63
|
+
], U = H.join(","), W = RegExp(`<(${H.join("|")})(\\s|>|/)`, "i"), G = (e) => e?.currentSrc || e?.src || e?.getAttribute?.("data-src") || "", K = (e) => {
|
|
63
64
|
if (!e) return !1;
|
|
64
|
-
if (typeof document > "u") return
|
|
65
|
+
if (typeof document > "u") return W.test(e) ? !0 : e.replace(/<[^>]+>/g, "").replace(V, "").length > 0;
|
|
65
66
|
let t = document.createElement("div");
|
|
66
|
-
return t.innerHTML = e, t.querySelector(
|
|
67
|
-
},
|
|
67
|
+
return t.innerHTML = e, t.querySelector(U) ? !0 : t.textContent?.replace(V, "").length > 0;
|
|
68
|
+
}, q = (e) => K(e) ? e : "", J = (e, t = q(e)) => t === "" ? C : e || C, Y = () => {
|
|
68
69
|
if (E.disabled) {
|
|
69
70
|
l(() => {
|
|
70
|
-
$(),
|
|
71
|
+
$(), ae();
|
|
71
72
|
});
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
75
|
$();
|
|
75
|
-
},
|
|
76
|
-
|
|
76
|
+
}, X = () => {
|
|
77
|
+
let e = O.value;
|
|
78
|
+
if (e) {
|
|
77
79
|
if (E.disabled) {
|
|
78
|
-
|
|
80
|
+
e.disable?.(), Y();
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
e.enable?.(), $();
|
|
82
84
|
}
|
|
83
|
-
},
|
|
84
|
-
O.value = Object.seal(e), E.disabled &&
|
|
85
|
-
},
|
|
86
|
-
let t =
|
|
87
|
-
t !== A.value && (j.value = t, A.value = t, D("update:model-value", t),
|
|
88
|
-
},
|
|
85
|
+
}, Z = (e) => {
|
|
86
|
+
O.value = Object.seal(e), E.disabled && X();
|
|
87
|
+
}, Q = (e) => {
|
|
88
|
+
let t = q(e);
|
|
89
|
+
t !== A.value && (j.value = t, A.value = t, D("update:model-value", t), z?.validate("change"), z?.validate("blur"));
|
|
90
|
+
}, te = (e) => {
|
|
89
91
|
if (!E.disabled) return;
|
|
90
92
|
let t = e?.target?.closest?.("img");
|
|
91
93
|
if (!t) return;
|
|
92
94
|
let n = O.value?.getEditableContainer?.(), r = Array.from(n?.querySelectorAll?.("img") || []);
|
|
93
95
|
if (r.length === 0) return;
|
|
94
|
-
let i =
|
|
95
|
-
if (
|
|
96
|
-
let
|
|
97
|
-
|
|
98
|
-
},
|
|
96
|
+
let i = r.map(G).filter(Boolean);
|
|
97
|
+
if (i.length === 0) return;
|
|
98
|
+
let a = G(t), o = i.findIndex((e) => e === a);
|
|
99
|
+
P.value = i, F.value = o >= 0 ? o : 0, N.value = !0, e?.stopPropagation?.();
|
|
100
|
+
}, ne = (e) => {
|
|
99
101
|
if (E.disabled) {
|
|
100
|
-
|
|
102
|
+
te(e);
|
|
101
103
|
return;
|
|
102
104
|
}
|
|
103
105
|
O.value?.focus?.();
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
+
}, re = () => {
|
|
107
|
+
N.value = !1, P.value = [], F.value = 0;
|
|
106
108
|
}, $ = () => {
|
|
107
|
-
|
|
109
|
+
I.forEach(({ app: e, host: t, pre: n }) => {
|
|
108
110
|
t?.isConnected && n?.isConnected && t.parentNode && t.parentNode.insertBefore(n, t), e.unmount(), t?.remove();
|
|
109
|
-
}),
|
|
110
|
-
},
|
|
111
|
+
}), I.clear();
|
|
112
|
+
}, ie = (e) => {
|
|
111
113
|
let t = document.createElement("div");
|
|
112
114
|
e.parentNode?.insertBefore(t, e);
|
|
113
115
|
let r = i(n), a = r.mount(t);
|
|
114
|
-
(a.contentRef?.value || a.contentRef)?.appendChild(e),
|
|
116
|
+
(a.contentRef?.value || a.contentRef)?.appendChild(e), I.set(e, {
|
|
115
117
|
app: r,
|
|
116
118
|
host: t,
|
|
117
119
|
pre: e
|
|
118
120
|
});
|
|
119
|
-
},
|
|
121
|
+
}, ae = () => {
|
|
120
122
|
let e = O.value?.getEditableContainer?.()?.querySelectorAll("pre");
|
|
121
123
|
e && e.forEach((e) => {
|
|
122
|
-
e.parentElement?.tagName !== "DETAILS" &&
|
|
124
|
+
e.parentElement?.tagName !== "DETAILS" && ie(e);
|
|
123
125
|
});
|
|
124
|
-
},
|
|
125
|
-
placeholder: E.disabled ? "" : E.placeholder ||
|
|
126
|
+
}, oe = r(() => ({
|
|
127
|
+
placeholder: E.disabled ? "" : E.placeholder || L("d.editor.placeholder"),
|
|
126
128
|
readOnly: E.disabled,
|
|
127
129
|
autoFocus: !1,
|
|
128
130
|
...E.editorConfig
|
|
129
|
-
})),
|
|
130
|
-
return _(
|
|
131
|
-
|
|
131
|
+
})), se = r(() => ({ "--minHeight": E.disabled ? "" : `${E.minHeight}px` }));
|
|
132
|
+
return _(B, (e) => {
|
|
133
|
+
b(e === "zh-cn" ? "zh-CN" : "en");
|
|
132
134
|
}, { immediate: !0 }), _(() => E.disabled, () => {
|
|
133
|
-
|
|
135
|
+
X();
|
|
134
136
|
}), _(() => E.modelValue, (e) => {
|
|
135
|
-
let t =
|
|
136
|
-
A.value = t, j.value = null,
|
|
137
|
+
let t = q(e), n = J(e, t), r = A.value, i = j.value === t;
|
|
138
|
+
if (A.value = t, j.value = null, !i && O.value && t !== r) {
|
|
139
|
+
O.value = null, k.value = n, M.value++, Y();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
i && n !== e || (k.value = n, i || Y());
|
|
137
143
|
}, { immediate: !0 }), f(() => {
|
|
138
144
|
$(), O.value?.destroy?.();
|
|
139
|
-
}), w({ editorRef: O }), (e, n) => (p(), s("div", {
|
|
140
|
-
|
|
141
|
-
"editor
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
}), w({ editorRef: O }), (e, n) => (p(), s("div", {
|
|
146
|
+
key: M.value,
|
|
147
|
+
class: u(["d-editor", {
|
|
148
|
+
"editor-border": t.border,
|
|
149
|
+
"editor-disabled": t.disabled
|
|
150
|
+
}])
|
|
151
|
+
}, [
|
|
152
|
+
ee(c(h(S), {
|
|
144
153
|
class: "toolbar-container",
|
|
145
154
|
editor: O.value,
|
|
146
|
-
"default-config":
|
|
155
|
+
"default-config": t.toolbarConfig,
|
|
147
156
|
mode: t.mode
|
|
148
157
|
}, null, 8, [
|
|
149
158
|
"editor",
|
|
150
159
|
"default-config",
|
|
151
160
|
"mode"
|
|
152
161
|
]), [[g, t.showToolbar && !t.disabled]]),
|
|
153
|
-
c(h(
|
|
162
|
+
c(h(x), {
|
|
154
163
|
class: "editor-container",
|
|
155
|
-
style: d(
|
|
164
|
+
style: d(se.value),
|
|
156
165
|
"model-value": k.value,
|
|
157
|
-
"default-config":
|
|
166
|
+
"default-config": oe.value,
|
|
158
167
|
mode: t.mode,
|
|
159
|
-
onOnCreated:
|
|
160
|
-
"onUpdate:modelValue":
|
|
161
|
-
onClick:
|
|
168
|
+
onOnCreated: Z,
|
|
169
|
+
"onUpdate:modelValue": Q,
|
|
170
|
+
onClick: ne
|
|
162
171
|
}, null, 8, [
|
|
163
172
|
"style",
|
|
164
173
|
"model-value",
|
|
165
174
|
"default-config",
|
|
166
175
|
"mode"
|
|
167
176
|
]),
|
|
168
|
-
|
|
177
|
+
N.value ? (p(), a(h(v), {
|
|
169
178
|
key: 0,
|
|
170
|
-
"url-list":
|
|
171
|
-
"initial-index":
|
|
179
|
+
"url-list": P.value,
|
|
180
|
+
"initial-index": F.value,
|
|
172
181
|
"hide-on-click-modal": "",
|
|
173
182
|
teleported: "",
|
|
174
|
-
onClose:
|
|
183
|
+
onClose: re
|
|
175
184
|
}, null, 8, ["url-list", "initial-index"])) : o("", !0)
|
|
176
185
|
], 2));
|
|
177
186
|
}
|
|
178
|
-
}), [["__scopeId", "data-v-
|
|
187
|
+
}), [["__scopeId", "data-v-e54f6c52"]]);
|
|
179
188
|
//#endregion
|
|
180
189
|
export { w as default };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.d-editor[data-v-8a540657]{width:100%}.d-editor.w-e-full-screen-container[data-v-8a540657]{z-index:1000}.d-editor .toolbar-container[data-v-8a540657]{border-bottom:1px solid var(--el-border-color)}.d-editor .toolbar-container[data-v-8a540657] .w-e-toolbar{border-radius:4px}.d-editor .toolbar-container[data-v-8a540657] .w-e-drop-panel{z-index:100}.d-editor .editor-container[data-v-8a540657]{min-height:var(--minHeight);background:var(--el-fill-color-blank);border-radius:4px}.d-editor .editor-container[data-v-8a540657] p[id^=w-e-element-paragraph-]{margin:10px 0}.d-editor .editor-container[data-v-8a540657] .w-e-text-placeholder{font-size:14px;font-style:normal;line-height:normal;top:11px}.d-editor .editor-container[data-v-8a540657] .w-e-image-container{width:500px}.d-editor .editor-container[data-v-8a540657] pre code{text-shadow:none}.d-editor.editor-disabled[data-v-8a540657]:not(.editor-border) div[id^=w-e-textarea-]{padding:0}.d-editor.editor-disabled[data-v-8a540657]:not(.editor-border) p[id^=w-e-element-paragraph-]:first-child{margin-top:0}.d-editor.editor-disabled[data-v-8a540657]:not(.editor-border) p[id^=w-e-element-paragraph-]:last-child{margin-bottom:0}.editor-border[data-v-8a540657]{border:1px solid var(--el-border-color);background:var(--el-bg-color);border-radius:4px;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.editor-border[data-v-8a540657]:hover{border-color:var(--el-text-color-disabled)}.editor-disabled .editor-container[data-v-8a540657] img{cursor:zoom-in}.el-form-item.is-error .editor-border[data-v-8a540657]{border:1px solid var(--el-color-danger)}
|