@kungal/editor-vue 0.5.0 → 0.6.0
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/CHANGELOG.md +25 -0
- package/README.md +7 -2
- package/dist/components/EditorToolbar.vue.d.ts.map +1 -1
- package/dist/components/KunEditor.vue.d.ts.map +1 -1
- package/dist/components/StickerPicker.vue.d.ts +4 -0
- package/dist/components/StickerPicker.vue.d.ts.map +1 -0
- package/dist/context.d.ts +4 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/emoji.d.ts +2 -0
- package/dist/emoji.d.ts.map +1 -0
- package/dist/index.js +229 -114
- package/dist/style.css +1 -1
- package/dist/toolbar-icons.d.ts +1 -0
- package/dist/toolbar-icons.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @kungal/editor-vue
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a4cbd3a: P3 — add the sticker / emoji picker to the toolbar.
|
|
8
|
+
|
|
9
|
+
A merged popover (ported from the forum's sticker + emoji Containers):
|
|
10
|
+
|
|
11
|
+
- **Emoji tab** — a built-in curated unicode set, inserted as plain text. No
|
|
12
|
+
adapter, always available.
|
|
13
|
+
- **Sticker tab** — appears only when the host supplies the `stickerSource`
|
|
14
|
+
adapter; loads packs lazily on first open and inserts each sticker as an image
|
|
15
|
+
node (`insertImageCommand`). Stickers are images, so an image-free editor gets
|
|
16
|
+
emoji only.
|
|
17
|
+
|
|
18
|
+
Self-contained (no `@kungal/ui-vue`): a plain trigger button + a click-outside
|
|
19
|
+
popover, themed via CSS variables. Gated by `features.sticker` (default on). The
|
|
20
|
+
`KunEditorContext` now also carries `features` so views can read the flags.
|
|
21
|
+
Verified end-to-end in a browser via `apps/playground` (emoji → text; sticker →
|
|
22
|
+
image node in the v-model markdown).
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- @kungal/editor-core@0.6.0
|
|
27
|
+
|
|
3
28
|
## 0.5.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -65,8 +65,13 @@ supplies `searchMentionUsers` — a debounced, keyboard-navigable dropdown offer
|
|
|
65
65
|
users and inserts a mention chip (`[@name](kungal-user:id)`). Without the adapter
|
|
66
66
|
the mention schema still round-trips; there's just no autocomplete.
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
The **sticker / emoji picker** is a toolbar popover: a built-in emoji tab
|
|
69
|
+
(unicode, inserted as text — no adapter) plus a sticker tab that appears when the
|
|
70
|
+
host supplies `stickerSource`, inserting each sticker as an image node. Turn the
|
|
71
|
+
whole picker off with `features.sticker: false`.
|
|
72
|
+
|
|
73
|
+
Still to come in P3: the CodeMirror markdown-source view (currently a
|
|
74
|
+
`<textarea>`). See
|
|
70
75
|
[`../../docs/architecture.md`](../../docs/architecture.md) § migration.
|
|
71
76
|
|
|
72
77
|
## Build
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"AAqbA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AAoNA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAK5B,KAAK,WAAW,GAAG;IACf,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,qDAAqD;IACrD,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC;AA+LJ,QAAA,MAAM,YAAY;;;;;cAtMH,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;6EAoMpB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
4
|
+
//# sourceMappingURL=StickerPicker.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickerPicker.vue.d.ts","sourceRoot":"","sources":["../../src/components/StickerPicker.vue"],"names":[],"mappings":"AAyhBA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { InjectionKey } from 'vue';
|
|
2
|
-
import type { KunEditorAdapters, KunEditorLocale } from '@kungal/editor-core';
|
|
2
|
+
import type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale } from '@kungal/editor-core';
|
|
3
3
|
export interface KunEditorContext {
|
|
4
4
|
/** The host policy bundle (searchMentionUsers, stickerSource, notify, …). */
|
|
5
5
|
readonly adapters: KunEditorAdapters;
|
|
6
|
-
/**
|
|
6
|
+
/** Which optional plugins/views are enabled. */
|
|
7
|
+
readonly features: KunEditorFeatures;
|
|
8
|
+
/** UI language, for view chrome (dropdown hints, picker tabs, etc.). */
|
|
7
9
|
readonly locale: KunEditorLocale;
|
|
8
10
|
}
|
|
9
11
|
export declare const KUN_EDITOR_CONTEXT: InjectionKey<KunEditorContext>;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AACvC,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CACjC;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,gBAAgB,CAChC,CAAA"}
|
package/dist/emoji.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emoji.d.ts","sourceRoot":"","sources":["../src/emoji.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,EAAE,SAAS,MAAM,EAsBlC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, inject as c, onBeforeUnmount as l, onMounted as u, openBlock as d, provide as f, ref as p, renderList as m, toDisplayString as h, unref as g, vShow as _, watch as v, withCtx as y, withDirectives as b, withModifiers as x } from "vue";
|
|
2
2
|
import { Milkdown as S, MilkdownProvider as C, useEditor as w, useInstance as T } from "@milkdown/vue";
|
|
3
3
|
import { ProsemirrorAdapterProvider as E, usePluginViewContext as D, usePluginViewFactory as O } from "@prosemirror-adapter/vue";
|
|
4
|
-
import { Editor as k, defaultValueCtx as A,
|
|
5
|
-
import { listenerCtx as
|
|
6
|
-
import { SlashProvider as
|
|
4
|
+
import { Editor as k, defaultValueCtx as A, editorViewCtx as j, editorViewOptionsCtx as M, rootCtx as N } from "@milkdown/kit/core";
|
|
5
|
+
import { listenerCtx as P } from "@milkdown/kit/plugin/listener";
|
|
6
|
+
import { SlashProvider as ee, slashFactory as F } from "@milkdown/kit/plugin/slash";
|
|
7
7
|
import { callCommand as I, replaceAll as L } from "@milkdown/kit/utils";
|
|
8
|
-
import { createKunEditorPlugins as
|
|
9
|
-
import { TextSelection as
|
|
10
|
-
import { createCodeBlockCommand as
|
|
8
|
+
import { createKunEditorPlugins as te, insertKunSpoilerCommand as R, mentionId as ne, toggleLatexCommand as re } from "@kungal/editor-core/preset";
|
|
9
|
+
import { TextSelection as ie } from "@milkdown/kit/prose/state";
|
|
10
|
+
import { createCodeBlockCommand as ae, insertHrCommand as oe, insertImageCommand as z, toggleEmphasisCommand as B, toggleInlineCodeCommand as V, toggleStrongCommand as H, wrapInBlockquoteCommand as U, wrapInBulletListCommand as W, wrapInHeadingCommand as G, wrapInOrderedListCommand as K } from "@milkdown/kit/preset/commonmark";
|
|
11
11
|
import { toggleStrikethroughCommand as q } from "@milkdown/kit/preset/gfm";
|
|
12
12
|
//#region src/context.ts
|
|
13
|
-
var J = Symbol("kun-editor-context"),
|
|
13
|
+
var J = Symbol("kun-editor-context"), se = [
|
|
14
14
|
"data-active",
|
|
15
15
|
"onMousedown",
|
|
16
16
|
"onMouseenter"
|
|
17
|
-
],
|
|
17
|
+
], ce = ["src", "alt"], le = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "kun-mention-dropdown__avatar kun-mention-dropdown__avatar--fallback"
|
|
20
|
-
},
|
|
20
|
+
}, ue = { class: "kun-mention-dropdown__name" }, de = {
|
|
21
21
|
key: 1,
|
|
22
22
|
class: "kun-mention-dropdown__hint"
|
|
23
|
-
},
|
|
23
|
+
}, fe = {
|
|
24
24
|
key: 2,
|
|
25
25
|
class: "kun-mention-dropdown__hint"
|
|
26
|
-
},
|
|
26
|
+
}, pe = {
|
|
27
27
|
key: 3,
|
|
28
28
|
class: "kun-mention-dropdown__hint"
|
|
29
|
-
},
|
|
29
|
+
}, me = /* @__PURE__ */ s({
|
|
30
30
|
__name: "MentionDropdown",
|
|
31
31
|
setup(n) {
|
|
32
32
|
let r = /(?:^|\s)@([^\s@]{0,30})$/, o = c(J), s = o?.adapters.searchMentionUsers, f = t(() => (o?.locale ?? "zh-cn").toLowerCase().startsWith("en")), g = t(() => f.value ? {
|
|
@@ -53,30 +53,30 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
53
53
|
}
|
|
54
54
|
t === A && (T.value = n ?? [], E.value = 0, O.value = !1);
|
|
55
55
|
}, 180);
|
|
56
|
-
},
|
|
56
|
+
}, P = (e) => {
|
|
57
57
|
let { selection: t } = e.state;
|
|
58
58
|
if (!t.empty) return null;
|
|
59
59
|
let { $from: n } = t, i = n.parent.textBetween(Math.max(0, n.parentOffset - 100), n.parentOffset, void 0, "").match(r);
|
|
60
60
|
return i ? i[1] ?? "" : null;
|
|
61
|
-
},
|
|
62
|
-
let t =
|
|
61
|
+
}, F = (e) => {
|
|
62
|
+
let t = P(e);
|
|
63
63
|
if (t === null) return !1;
|
|
64
64
|
let n = e.state.selection.$from.pos;
|
|
65
65
|
return k = {
|
|
66
66
|
from: n - (t.length + 1),
|
|
67
67
|
to: n
|
|
68
68
|
}, t !== w.value && (w.value = t, N(t)), !0;
|
|
69
|
-
},
|
|
69
|
+
}, I = (e) => {
|
|
70
70
|
let t = _.value;
|
|
71
71
|
if (!t || !k) return;
|
|
72
|
-
let n = t.state.schema.nodes[
|
|
72
|
+
let n = t.state.schema.nodes[ne];
|
|
73
73
|
if (!n) return;
|
|
74
74
|
let r = n.create({
|
|
75
75
|
userId: e.id,
|
|
76
76
|
name: e.name
|
|
77
77
|
}), { from: i, to: a } = k, o = t.state.tr.replaceWith(i, a, r), s = i + r.nodeSize;
|
|
78
|
-
o.insertText(" ", s), o.setSelection(
|
|
79
|
-
},
|
|
78
|
+
o.insertText(" ", s), o.setSelection(ie.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), S.hide();
|
|
79
|
+
}, L = (e) => {
|
|
80
80
|
if (!C.value || !T.value.length) {
|
|
81
81
|
C.value && e.key === "Escape" && (e.preventDefault(), S.hide());
|
|
82
82
|
return;
|
|
@@ -92,7 +92,7 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
92
92
|
case "Enter":
|
|
93
93
|
case "Tab": {
|
|
94
94
|
let t = T.value[E.value];
|
|
95
|
-
t && (e.preventDefault(), e.stopPropagation(),
|
|
95
|
+
t && (e.preventDefault(), e.stopPropagation(), I(t));
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
case "Escape":
|
|
@@ -101,20 +101,20 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
return u(() => {
|
|
104
|
-
S = new
|
|
104
|
+
S = new ee({
|
|
105
105
|
content: b.value,
|
|
106
106
|
trigger: "@",
|
|
107
|
-
shouldShow:
|
|
107
|
+
shouldShow: F,
|
|
108
108
|
debounce: 0
|
|
109
109
|
}), S.onShow = () => {
|
|
110
110
|
C.value = !0;
|
|
111
111
|
}, S.onHide = () => {
|
|
112
112
|
C.value = !1, M();
|
|
113
|
-
}, S.update(_.value, y.value), window.addEventListener("keydown",
|
|
113
|
+
}, S.update(_.value, y.value), window.addEventListener("keydown", L, !0);
|
|
114
114
|
}), v([_, y], () => {
|
|
115
115
|
S?.update(_.value, y.value);
|
|
116
116
|
}), l(() => {
|
|
117
|
-
j && clearTimeout(j), window.removeEventListener("keydown",
|
|
117
|
+
j && clearTimeout(j), window.removeEventListener("keydown", L, !0), S?.destroy();
|
|
118
118
|
}), (t, n) => (d(), i("div", {
|
|
119
119
|
ref_key: "divRef",
|
|
120
120
|
ref: b,
|
|
@@ -125,16 +125,16 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
125
125
|
type: "button",
|
|
126
126
|
class: "kun-mention-dropdown__item",
|
|
127
127
|
"data-active": t === E.value,
|
|
128
|
-
onMousedown: x((t) =>
|
|
128
|
+
onMousedown: x((t) => I(e), ["prevent"]),
|
|
129
129
|
onMouseenter: (e) => E.value = t
|
|
130
130
|
}, [e.avatar ? (d(), i("img", {
|
|
131
131
|
key: 0,
|
|
132
132
|
src: e.avatar,
|
|
133
133
|
alt: e.name,
|
|
134
134
|
class: "kun-mention-dropdown__avatar"
|
|
135
|
-
}, null, 8,
|
|
135
|
+
}, null, 8, ce)) : (d(), i("span", le, h(e.name.charAt(0)), 1)), a("span", ue, h(e.name), 1)], 40, se))), 128)) : O.value ? (d(), i("div", de, h(g.value.searching), 1)) : w.value ? (d(), i("div", fe, h(g.value.empty), 1)) : (d(), i("div", pe, h(g.value.prompt), 1))], 512));
|
|
136
136
|
}
|
|
137
|
-
}),
|
|
137
|
+
}), he = /* @__PURE__ */ s({
|
|
138
138
|
__name: "MilkdownEditor",
|
|
139
139
|
props: {
|
|
140
140
|
modelValue: {},
|
|
@@ -147,13 +147,13 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
147
147
|
setup(e, { emit: t }) {
|
|
148
148
|
let r = e, i = t, a = r.modelValue, o = O(), s = F("kunMention"), c = r.features.mention !== !1 && !!r.adapters.searchMentionUsers && !!o, l = w((e) => {
|
|
149
149
|
let t = k.make().config((t) => {
|
|
150
|
-
t.set(
|
|
150
|
+
t.set(N, e), t.set(A, r.modelValue), t.get(P).markdownUpdated((e, t, n) => {
|
|
151
151
|
t !== n && (a = t, i("update:modelValue", t));
|
|
152
|
-
}), t.update(
|
|
152
|
+
}), t.update(M, (e) => ({
|
|
153
153
|
...e,
|
|
154
154
|
editable: () => !r.readonly
|
|
155
|
-
})), c && t.set(s.key, { view: o({ component:
|
|
156
|
-
}).use(
|
|
155
|
+
})), c && t.set(s.key, { view: o({ component: me }) });
|
|
156
|
+
}).use(te(r.adapters, r.features, { locale: r.locale }));
|
|
157
157
|
return c && t.use(s), t;
|
|
158
158
|
});
|
|
159
159
|
return v(() => r.modelValue, (e) => {
|
|
@@ -175,25 +175,130 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
175
175
|
hr: Y("<line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\"/>"),
|
|
176
176
|
image: Y("<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"1.8\" fill=\"currentColor\" stroke=\"none\"/><path d=\"m21 15-4.5-4.5a2 2 0 0 0-2.8 0L5 19\"/>"),
|
|
177
177
|
spoiler: Y("<path d=\"M9.9 4.24A9.1 9.1 0 0 1 12 4c7 0 10 8 10 8a13.2 13.2 0 0 1-1.67 2.68\"/><path d=\"M6.6 6.6A13.5 13.5 0 0 0 2 12s3 8 10 8a9.7 9.7 0 0 0 5.4-1.6\"/><line x1=\"2\" y1=\"2\" x2=\"22\" y2=\"22\"/>"),
|
|
178
|
-
latex: X("Σ", 15)
|
|
179
|
-
|
|
178
|
+
latex: X("Σ", 15),
|
|
179
|
+
smile: Y("<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M8 14s1.5 2 4 2 4-2 4-2\"/><line x1=\"9\" y1=\"9\" x2=\"9.01\" y2=\"9\"/><line x1=\"15\" y1=\"9\" x2=\"15.01\" y2=\"9\"/>")
|
|
180
|
+
}, ge = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), _e = [
|
|
181
|
+
"title",
|
|
182
|
+
"aria-label",
|
|
183
|
+
"aria-expanded"
|
|
184
|
+
], ve = ["innerHTML"], Q = { class: "kun-editor__picker-panel" }, ye = {
|
|
185
|
+
key: 0,
|
|
186
|
+
class: "kun-editor__picker-tabs",
|
|
187
|
+
role: "tablist"
|
|
188
|
+
}, be = ["data-active"], xe = ["data-active"], Se = { class: "kun-editor__emoji-grid" }, Ce = ["onClick"], we = {
|
|
189
|
+
key: 1,
|
|
190
|
+
class: "kun-editor__sticker-body"
|
|
191
|
+
}, Te = { class: "kun-editor__pack-name" }, Ee = { class: "kun-editor__sticker-grid" }, De = ["title", "onClick"], Oe = ["src", "alt"], ke = {
|
|
192
|
+
key: 1,
|
|
193
|
+
class: "kun-editor__picker-hint"
|
|
194
|
+
}, Ae = /* @__PURE__ */ s({
|
|
195
|
+
__name: "StickerPicker",
|
|
196
|
+
setup(n) {
|
|
197
|
+
let [, o] = T(), s = c(J), f = s?.adapters.stickerSource, v = !!f, y = t(() => (s?.locale ?? "zh-cn").toLowerCase().startsWith("en")), x = t(() => y.value ? {
|
|
198
|
+
trigger: "Emoji & stickers",
|
|
199
|
+
emoji: "Emoji",
|
|
200
|
+
sticker: "Stickers",
|
|
201
|
+
empty: "No stickers",
|
|
202
|
+
failed: "Failed to load stickers"
|
|
203
|
+
} : {
|
|
204
|
+
trigger: "表情与贴纸",
|
|
205
|
+
emoji: "表情",
|
|
206
|
+
sticker: "贴纸",
|
|
207
|
+
empty: "暂无贴纸",
|
|
208
|
+
failed: "贴纸加载失败"
|
|
209
|
+
}), S = p(!1), C = p(null), w = p("emoji"), E = p([]), D = p(!1), O = p(!1), k = async () => {
|
|
210
|
+
if (!(D.value || !f)) {
|
|
211
|
+
D.value = !0;
|
|
212
|
+
try {
|
|
213
|
+
E.value = await f();
|
|
214
|
+
} catch {
|
|
215
|
+
O.value = !0;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, A = () => {
|
|
219
|
+
S.value = !S.value, S.value && v && k();
|
|
220
|
+
}, M = (e) => {
|
|
221
|
+
S.value && C.value && !C.value.contains(e.target) && (S.value = !1);
|
|
222
|
+
};
|
|
223
|
+
u(() => document.addEventListener("click", M)), l(() => document.removeEventListener("click", M));
|
|
224
|
+
let N = (e) => {
|
|
225
|
+
o()?.action((t) => {
|
|
226
|
+
let n = t.get(j), { state: r } = n;
|
|
227
|
+
n.dispatch(r.tr.insertText(e, r.selection.from));
|
|
228
|
+
});
|
|
229
|
+
}, P = (e, t) => {
|
|
230
|
+
o()?.action(I(z.key, {
|
|
231
|
+
src: e,
|
|
232
|
+
title: t,
|
|
233
|
+
alt: t
|
|
234
|
+
}));
|
|
235
|
+
};
|
|
236
|
+
return (t, n) => (d(), i("div", {
|
|
237
|
+
ref_key: "rootRef",
|
|
238
|
+
ref: C,
|
|
239
|
+
class: "kun-editor__picker"
|
|
240
|
+
}, [a("button", {
|
|
241
|
+
type: "button",
|
|
242
|
+
class: "kun-editor__tool",
|
|
243
|
+
title: x.value.trigger,
|
|
244
|
+
"aria-label": x.value.trigger,
|
|
245
|
+
"aria-expanded": S.value,
|
|
246
|
+
onClick: A
|
|
247
|
+
}, [a("span", {
|
|
248
|
+
class: "kun-editor__icon",
|
|
249
|
+
innerHTML: g(Z).smile
|
|
250
|
+
}, null, 8, ve)], 8, _e), b(a("div", Q, [
|
|
251
|
+
v ? (d(), i("div", ye, [a("button", {
|
|
252
|
+
type: "button",
|
|
253
|
+
class: "kun-editor__picker-tab",
|
|
254
|
+
"data-active": w.value === "emoji",
|
|
255
|
+
onClick: n[0] ||= (e) => w.value = "emoji"
|
|
256
|
+
}, h(x.value.emoji), 9, be), a("button", {
|
|
257
|
+
type: "button",
|
|
258
|
+
class: "kun-editor__picker-tab",
|
|
259
|
+
"data-active": w.value === "sticker",
|
|
260
|
+
onClick: n[1] ||= (e) => w.value = "sticker"
|
|
261
|
+
}, h(x.value.sticker), 9, xe)])) : r("", !0),
|
|
262
|
+
b(a("div", Se, [(d(!0), i(e, null, m(g(ge), (e, t) => (d(), i("button", {
|
|
263
|
+
key: t,
|
|
264
|
+
type: "button",
|
|
265
|
+
class: "kun-editor__emoji",
|
|
266
|
+
onClick: (t) => N(e)
|
|
267
|
+
}, h(e), 9, Ce))), 128))], 512), [[_, !v || w.value === "emoji"]]),
|
|
268
|
+
v ? b((d(), i("div", we, [E.value.length ? (d(!0), i(e, { key: 0 }, m(E.value, (t) => (d(), i("div", {
|
|
269
|
+
key: t.name,
|
|
270
|
+
class: "kun-editor__pack"
|
|
271
|
+
}, [a("div", Te, h(t.name), 1), a("div", Ee, [(d(!0), i(e, null, m(t.stickers, (e, t) => (d(), i("button", {
|
|
272
|
+
key: t,
|
|
273
|
+
type: "button",
|
|
274
|
+
class: "kun-editor__sticker",
|
|
275
|
+
title: e.name,
|
|
276
|
+
onClick: (t) => P(e.src, e.name)
|
|
277
|
+
}, [a("img", {
|
|
278
|
+
src: e.src,
|
|
279
|
+
alt: e.name,
|
|
280
|
+
loading: "lazy"
|
|
281
|
+
}, null, 8, Oe)], 8, De))), 128))])]))), 128)) : (d(), i("div", ke, h(O.value ? x.value.failed : x.value.empty), 1))], 512)), [[_, w.value === "sticker"]]) : r("", !0)
|
|
282
|
+
], 512), [[_, S.value]])], 512));
|
|
283
|
+
}
|
|
284
|
+
}), je = {
|
|
180
285
|
class: "kun-editor__format-toolbar",
|
|
181
286
|
role: "toolbar"
|
|
182
|
-
},
|
|
287
|
+
}, Me = {
|
|
183
288
|
key: 0,
|
|
184
289
|
class: "kun-editor__toolbar-divider",
|
|
185
290
|
"aria-hidden": "true"
|
|
186
|
-
},
|
|
291
|
+
}, Ne = [
|
|
187
292
|
"title",
|
|
188
293
|
"aria-label",
|
|
189
294
|
"onClick"
|
|
190
|
-
],
|
|
295
|
+
], Pe = ["innerHTML"], Fe = ["title", "aria-label"], Ie = ["innerHTML"], Le = /* @__PURE__ */ s({
|
|
191
296
|
__name: "EditorToolbar",
|
|
192
297
|
setup(n) {
|
|
193
|
-
let [,
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
let e =
|
|
298
|
+
let [, s] = T(), l = c(J), u = t(() => l?.adapters.uploadImage), f = () => l?.adapters.notify, h = t(() => l?.features.sticker !== !1), _ = t(() => (l?.locale ?? "zh-cn").toLowerCase().startsWith("en")), v = (e, t) => {
|
|
299
|
+
s()?.action(I(e, t));
|
|
300
|
+
}, y = t(() => {
|
|
301
|
+
let e = _.value;
|
|
197
302
|
return {
|
|
198
303
|
bold: e ? "Bold" : "加粗",
|
|
199
304
|
italic: e ? "Italic" : "斜体",
|
|
@@ -211,139 +316,146 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
211
316
|
latex: e ? "Math (LaTeX)" : "公式",
|
|
212
317
|
image: e ? "Upload image" : "上传图片"
|
|
213
318
|
};
|
|
214
|
-
}),
|
|
319
|
+
}), b = t(() => [
|
|
215
320
|
[
|
|
216
321
|
{
|
|
217
322
|
svg: Z.bold,
|
|
218
|
-
title:
|
|
219
|
-
run: () =>
|
|
323
|
+
title: y.value.bold,
|
|
324
|
+
run: () => v(H.key)
|
|
220
325
|
},
|
|
221
326
|
{
|
|
222
327
|
svg: Z.italic,
|
|
223
|
-
title:
|
|
224
|
-
run: () =>
|
|
328
|
+
title: y.value.italic,
|
|
329
|
+
run: () => v(B.key)
|
|
225
330
|
},
|
|
226
331
|
{
|
|
227
332
|
svg: Z.strike,
|
|
228
|
-
title:
|
|
229
|
-
run: () =>
|
|
333
|
+
title: y.value.strike,
|
|
334
|
+
run: () => v(q.key)
|
|
230
335
|
},
|
|
231
336
|
{
|
|
232
337
|
svg: Z.code,
|
|
233
|
-
title:
|
|
234
|
-
run: () =>
|
|
338
|
+
title: y.value.code,
|
|
339
|
+
run: () => v(V.key)
|
|
235
340
|
}
|
|
236
341
|
],
|
|
237
342
|
[
|
|
238
343
|
{
|
|
239
344
|
svg: Z.h1,
|
|
240
|
-
title:
|
|
241
|
-
run: () =>
|
|
345
|
+
title: y.value.h1,
|
|
346
|
+
run: () => v(G.key, 1)
|
|
242
347
|
},
|
|
243
348
|
{
|
|
244
349
|
svg: Z.h2,
|
|
245
|
-
title:
|
|
246
|
-
run: () =>
|
|
350
|
+
title: y.value.h2,
|
|
351
|
+
run: () => v(G.key, 2)
|
|
247
352
|
},
|
|
248
353
|
{
|
|
249
354
|
svg: Z.h3,
|
|
250
|
-
title:
|
|
251
|
-
run: () =>
|
|
355
|
+
title: y.value.h3,
|
|
356
|
+
run: () => v(G.key, 3)
|
|
252
357
|
}
|
|
253
358
|
],
|
|
254
359
|
[
|
|
255
360
|
{
|
|
256
361
|
svg: Z.bulletList,
|
|
257
|
-
title:
|
|
258
|
-
run: () =>
|
|
362
|
+
title: y.value.bulletList,
|
|
363
|
+
run: () => v(W.key)
|
|
259
364
|
},
|
|
260
365
|
{
|
|
261
366
|
svg: Z.orderedList,
|
|
262
|
-
title:
|
|
263
|
-
run: () =>
|
|
367
|
+
title: y.value.orderedList,
|
|
368
|
+
run: () => v(K.key)
|
|
264
369
|
},
|
|
265
370
|
{
|
|
266
371
|
svg: Z.quote,
|
|
267
|
-
title:
|
|
268
|
-
run: () =>
|
|
372
|
+
title: y.value.quote,
|
|
373
|
+
run: () => v(U.key)
|
|
269
374
|
},
|
|
270
375
|
{
|
|
271
376
|
svg: Z.codeBlock,
|
|
272
|
-
title:
|
|
273
|
-
run: () =>
|
|
377
|
+
title: y.value.codeBlock,
|
|
378
|
+
run: () => v(ae.key, "")
|
|
274
379
|
},
|
|
275
380
|
{
|
|
276
381
|
svg: Z.hr,
|
|
277
|
-
title:
|
|
278
|
-
run: () =>
|
|
382
|
+
title: y.value.hr,
|
|
383
|
+
run: () => v(oe.key)
|
|
279
384
|
}
|
|
280
385
|
],
|
|
281
386
|
[{
|
|
282
387
|
svg: Z.spoiler,
|
|
283
|
-
title:
|
|
284
|
-
run: () =>
|
|
388
|
+
title: y.value.spoiler,
|
|
389
|
+
run: () => v(R.key)
|
|
285
390
|
}, {
|
|
286
391
|
svg: Z.latex,
|
|
287
|
-
title:
|
|
288
|
-
run: () =>
|
|
392
|
+
title: y.value.latex,
|
|
393
|
+
run: () => v(re.key)
|
|
289
394
|
}]
|
|
290
|
-
]),
|
|
395
|
+
]), x = p(null), S = () => x.value?.click(), C = async (e) => {
|
|
291
396
|
let t = e.target, n = t.files?.[0];
|
|
292
397
|
t.value = "";
|
|
293
|
-
let r =
|
|
398
|
+
let r = u.value;
|
|
294
399
|
if (!(!n || !r)) try {
|
|
295
400
|
let e = await r(n);
|
|
296
|
-
|
|
401
|
+
v(z.key, {
|
|
297
402
|
src: e,
|
|
298
403
|
title: n.name,
|
|
299
404
|
alt: n.name
|
|
300
405
|
});
|
|
301
406
|
} catch {
|
|
302
|
-
|
|
407
|
+
f()?.(_.value ? "Image upload failed" : "图片上传失败", "error");
|
|
303
408
|
}
|
|
304
409
|
};
|
|
305
|
-
return (t, n) => (d(), i("div",
|
|
306
|
-
key: t,
|
|
307
|
-
|
|
308
|
-
class: "kun-editor__tool",
|
|
309
|
-
title: e.title,
|
|
310
|
-
"aria-label": e.title,
|
|
311
|
-
onClick: (t) => e.run()
|
|
312
|
-
}, [a("span", {
|
|
313
|
-
class: "kun-editor__icon",
|
|
314
|
-
innerHTML: e.svg
|
|
315
|
-
}, null, 8, ve)], 8, _e))), 128))], 64))), 128)), l.value ? (d(), i(e, { key: 0 }, [
|
|
316
|
-
n[0] ||= a("span", {
|
|
317
|
-
class: "kun-editor__toolbar-divider",
|
|
318
|
-
"aria-hidden": "true"
|
|
319
|
-
}, null, -1),
|
|
320
|
-
a("button", {
|
|
410
|
+
return (t, n) => (d(), i("div", je, [
|
|
411
|
+
(d(!0), i(e, null, m(b.value, (t, n) => (d(), i(e, { key: n }, [n > 0 ? (d(), i("span", Me)) : r("", !0), (d(!0), i(e, null, m(t, (e, t) => (d(), i("button", {
|
|
412
|
+
key: t,
|
|
321
413
|
type: "button",
|
|
322
414
|
class: "kun-editor__tool",
|
|
323
|
-
title:
|
|
324
|
-
"aria-label":
|
|
325
|
-
onClick:
|
|
415
|
+
title: e.title,
|
|
416
|
+
"aria-label": e.title,
|
|
417
|
+
onClick: (t) => e.run()
|
|
326
418
|
}, [a("span", {
|
|
327
419
|
class: "kun-editor__icon",
|
|
328
|
-
innerHTML:
|
|
329
|
-
}, null, 8,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
420
|
+
innerHTML: e.svg
|
|
421
|
+
}, null, 8, Pe)], 8, Ne))), 128))], 64))), 128)),
|
|
422
|
+
u.value ? (d(), i(e, { key: 0 }, [
|
|
423
|
+
n[0] ||= a("span", {
|
|
424
|
+
class: "kun-editor__toolbar-divider",
|
|
425
|
+
"aria-hidden": "true"
|
|
426
|
+
}, null, -1),
|
|
427
|
+
a("button", {
|
|
428
|
+
type: "button",
|
|
429
|
+
class: "kun-editor__tool",
|
|
430
|
+
title: y.value.image,
|
|
431
|
+
"aria-label": y.value.image,
|
|
432
|
+
onClick: S
|
|
433
|
+
}, [a("span", {
|
|
434
|
+
class: "kun-editor__icon",
|
|
435
|
+
innerHTML: g(Z).image
|
|
436
|
+
}, null, 8, Ie)], 8, Fe),
|
|
437
|
+
a("input", {
|
|
438
|
+
ref_key: "fileInput",
|
|
439
|
+
ref: x,
|
|
440
|
+
type: "file",
|
|
441
|
+
accept: ".jpg,.jpeg,.png,.webp,.gif",
|
|
442
|
+
hidden: "",
|
|
443
|
+
onChange: C
|
|
444
|
+
}, null, 544)
|
|
445
|
+
], 64)) : r("", !0),
|
|
446
|
+
h.value ? (d(), i(e, { key: 1 }, [n[1] ||= a("span", {
|
|
447
|
+
class: "kun-editor__toolbar-divider",
|
|
448
|
+
"aria-hidden": "true"
|
|
449
|
+
}, null, -1), o(Ae)], 64)) : r("", !0)
|
|
450
|
+
]));
|
|
339
451
|
}
|
|
340
|
-
}),
|
|
452
|
+
}), Re = {
|
|
341
453
|
class: "kun-editor",
|
|
342
454
|
"data-kun-editor": ""
|
|
343
|
-
},
|
|
455
|
+
}, ze = {
|
|
344
456
|
class: "kun-editor__toolbar",
|
|
345
457
|
role: "tablist"
|
|
346
|
-
},
|
|
458
|
+
}, Be = ["aria-selected", "data-active"], Ve = ["aria-selected", "data-active"], He = { class: "kun-editor__wysiwyg" }, Ue = [
|
|
347
459
|
"value",
|
|
348
460
|
"readonly",
|
|
349
461
|
"lang"
|
|
@@ -366,6 +478,9 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
366
478
|
get adapters() {
|
|
367
479
|
return r.adapters;
|
|
368
480
|
},
|
|
481
|
+
get features() {
|
|
482
|
+
return r.features;
|
|
483
|
+
},
|
|
369
484
|
get locale() {
|
|
370
485
|
return r.locale;
|
|
371
486
|
}
|
|
@@ -377,23 +492,23 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
377
492
|
wysiwyg: "预览",
|
|
378
493
|
source: "Markdown"
|
|
379
494
|
}), m = (e) => s("update:modelValue", e), v = (e) => s("update:modelValue", e.target.value);
|
|
380
|
-
return (t, n) => (d(), i("div",
|
|
381
|
-
a("div",
|
|
495
|
+
return (t, n) => (d(), i("div", Re, [
|
|
496
|
+
a("div", ze, [a("button", {
|
|
382
497
|
type: "button",
|
|
383
498
|
class: "kun-editor__tab",
|
|
384
499
|
"aria-selected": c.value === "wysiwyg",
|
|
385
500
|
"data-active": c.value === "wysiwyg",
|
|
386
501
|
onClick: n[0] ||= (e) => c.value = "wysiwyg"
|
|
387
|
-
}, h(u.value.wysiwyg), 9,
|
|
502
|
+
}, h(u.value.wysiwyg), 9, Be), a("button", {
|
|
388
503
|
type: "button",
|
|
389
504
|
class: "kun-editor__tab",
|
|
390
505
|
"aria-selected": c.value === "source",
|
|
391
506
|
"data-active": c.value === "source",
|
|
392
507
|
onClick: n[1] ||= (e) => c.value = "source"
|
|
393
|
-
}, h(u.value.source), 9,
|
|
508
|
+
}, h(u.value.source), 9, Ve)]),
|
|
394
509
|
o(g(C), null, {
|
|
395
510
|
default: y(() => [o(g(E), null, {
|
|
396
|
-
default: y(() => [b(o(
|
|
511
|
+
default: y(() => [b(o(Le, null, null, 512), [[_, c.value === "wysiwyg" && !e.readonly]]), b(a("div", He, [o(he, {
|
|
397
512
|
"model-value": e.modelValue,
|
|
398
513
|
adapters: e.adapters,
|
|
399
514
|
features: e.features,
|
|
@@ -418,11 +533,11 @@ var J = Symbol("kun-editor-context"), oe = [
|
|
|
418
533
|
lang: e.locale,
|
|
419
534
|
spellcheck: "false",
|
|
420
535
|
onInput: v
|
|
421
|
-
}, null, 40,
|
|
536
|
+
}, null, 40, Ue), [[_, c.value === "source"]])
|
|
422
537
|
]));
|
|
423
538
|
}
|
|
424
|
-
}),
|
|
539
|
+
}), We = { install(e) {
|
|
425
540
|
e.component("KunEditor", $);
|
|
426
541
|
} };
|
|
427
542
|
//#endregion
|
|
428
|
-
export { $ as KunEditor,
|
|
543
|
+
export { $ as KunEditor, We as KunEditorPlugin };
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.kun-mention-dropdown{z-index:30;background:var(--color-background,#fff);border:1px solid var(--color-default-200,#e4e4e7);border-radius:.5rem;min-width:12rem;max-width:20rem;max-height:16rem;padding:.25rem;display:none;position:absolute;overflow-y:auto;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.kun-mention-dropdown[data-show=true]{display:block}.kun-mention-dropdown__item{width:100%;font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:.375rem;align-items:center;gap:.5rem;padding:.375rem .5rem;display:flex}.kun-mention-dropdown__item:hover,.kun-mention-dropdown__item[data-active=true]{background:var(--color-default-100,#f4f4f5)}.kun-mention-dropdown__avatar{object-fit:cover;border-radius:9999px;flex-shrink:0;width:1.5rem;height:1.5rem}.kun-mention-dropdown__avatar--fallback{background:var(--color-default-200,#e4e4e7);color:var(--color-default-600,#52525b);justify-content:center;align-items:center;font-size:.75rem;display:flex}.kun-mention-dropdown__name{text-overflow:ellipsis;white-space:nowrap;font-size:.875rem;overflow:hidden}.kun-mention-dropdown__hint{color:var(--color-default-400,#a1a1aa);padding:.375rem .5rem;font-size:.875rem}.kun-editor__format-toolbar{flex-wrap:wrap;align-items:center;gap:.125rem;display:flex}.kun-editor__toolbar-divider{background:var(--color-default-200,#e4e4e7);align-self:stretch;width:1px;margin:.25rem}.kun-editor__tool{width:1.75rem;height:1.75rem;color:var(--color-foreground,#27272a);cursor:pointer;background:0 0;border:none;border-radius:.375rem;justify-content:center;align-items:center;padding:0;display:inline-flex}.kun-editor__tool:hover{background:var(--color-default-100,#f4f4f5)}.kun-editor__icon{display:inline-flex}.kun-editor{flex-direction:column;gap:.5rem;display:flex}.kun-editor__toolbar{gap:.25rem;display:flex}.kun-editor__tab{border:1px solid var(--color-default-200,#e4e4e7);font:inherit;cursor:pointer;background:0 0;border-radius:.5rem;padding:.25rem .75rem}.kun-editor__tab[data-active=true]{background:var(--color-primary,#006fee);border-color:var(--color-primary,#006fee);color:#fff}.kun-editor__wysiwyg .milkdown{outline:none}.kun-editor__wysiwyg .ProseMirror{border:1px solid var(--color-default-200,#e4e4e7);white-space:pre-wrap;word-wrap:break-word;border-radius:.5rem;outline:none;min-height:8rem;padding:.75rem}.kun-editor__source{border:1px solid var(--color-default-200,#e4e4e7);resize:vertical;border-radius:.5rem;width:100%;min-height:8rem;padding:.75rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.875rem}
|
|
1
|
+
.kun-mention-dropdown{z-index:30;background:var(--color-background,#fff);border:1px solid var(--color-default-200,#e4e4e7);border-radius:.5rem;min-width:12rem;max-width:20rem;max-height:16rem;padding:.25rem;display:none;position:absolute;overflow-y:auto;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.kun-mention-dropdown[data-show=true]{display:block}.kun-mention-dropdown__item{width:100%;font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:.375rem;align-items:center;gap:.5rem;padding:.375rem .5rem;display:flex}.kun-mention-dropdown__item:hover,.kun-mention-dropdown__item[data-active=true]{background:var(--color-default-100,#f4f4f5)}.kun-mention-dropdown__avatar{object-fit:cover;border-radius:9999px;flex-shrink:0;width:1.5rem;height:1.5rem}.kun-mention-dropdown__avatar--fallback{background:var(--color-default-200,#e4e4e7);color:var(--color-default-600,#52525b);justify-content:center;align-items:center;font-size:.75rem;display:flex}.kun-mention-dropdown__name{text-overflow:ellipsis;white-space:nowrap;font-size:.875rem;overflow:hidden}.kun-mention-dropdown__hint{color:var(--color-default-400,#a1a1aa);padding:.375rem .5rem;font-size:.875rem}.kun-editor__picker{display:inline-flex;position:relative}.kun-editor__picker-panel{z-index:30;background:var(--color-background,#fff);border:1px solid var(--color-default-200,#e4e4e7);border-radius:.5rem;width:18rem;padding:.5rem;position:absolute;top:calc(100% + .25rem);left:0;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.kun-editor__picker-tabs{gap:.25rem;margin-bottom:.5rem;display:flex}.kun-editor__picker-tab{font:inherit;cursor:pointer;background:0 0;border:none;border-bottom:2px solid #0000;flex:1;padding:.25rem .5rem}.kun-editor__picker-tab[data-active=true]{border-bottom-color:var(--color-primary,#006fee);color:var(--color-primary,#006fee)}.kun-editor__emoji-grid{grid-template-columns:repeat(8,1fr);gap:.125rem;max-height:16rem;display:grid;overflow-y:auto}.kun-editor__emoji{aspect-ratio:1;cursor:pointer;background:0 0;border:none;border-radius:.375rem;font-size:1.25rem;line-height:1}.kun-editor__emoji:hover{background:var(--color-default-100,#f4f4f5)}.kun-editor__sticker-body{max-height:16rem;overflow-y:auto}.kun-editor__pack-name{color:var(--color-default-500,#71717a);padding:.25rem .125rem;font-size:.75rem}.kun-editor__sticker-grid{grid-template-columns:repeat(5,1fr);gap:.25rem;display:grid}.kun-editor__sticker{aspect-ratio:1;cursor:pointer;background:0 0;border:none;border-radius:.375rem;padding:.125rem}.kun-editor__sticker:hover{background:var(--color-default-100,#f4f4f5)}.kun-editor__sticker img{object-fit:contain;width:100%;height:100%}.kun-editor__picker-hint{color:var(--color-default-400,#a1a1aa);text-align:center;padding:1rem;font-size:.875rem}.kun-editor__format-toolbar{flex-wrap:wrap;align-items:center;gap:.125rem;display:flex}.kun-editor__toolbar-divider{background:var(--color-default-200,#e4e4e7);align-self:stretch;width:1px;margin:.25rem}.kun-editor__tool{width:1.75rem;height:1.75rem;color:var(--color-foreground,#27272a);cursor:pointer;background:0 0;border:none;border-radius:.375rem;justify-content:center;align-items:center;padding:0;display:inline-flex}.kun-editor__tool:hover{background:var(--color-default-100,#f4f4f5)}.kun-editor__icon{display:inline-flex}.kun-editor{flex-direction:column;gap:.5rem;display:flex}.kun-editor__toolbar{gap:.25rem;display:flex}.kun-editor__tab{border:1px solid var(--color-default-200,#e4e4e7);font:inherit;cursor:pointer;background:0 0;border-radius:.5rem;padding:.25rem .75rem}.kun-editor__tab[data-active=true]{background:var(--color-primary,#006fee);border-color:var(--color-primary,#006fee);color:#fff}.kun-editor__wysiwyg .milkdown{outline:none}.kun-editor__wysiwyg .ProseMirror{border:1px solid var(--color-default-200,#e4e4e7);white-space:pre-wrap;word-wrap:break-word;border-radius:.5rem;outline:none;min-height:8rem;padding:.75rem}.kun-editor__source{border:1px solid var(--color-default-200,#e4e4e7);resize:vertical;border-radius:.5rem;width:100%;min-height:8rem;padding:.75rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.875rem}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/toolbar-icons.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar-icons.d.ts","sourceRoot":"","sources":["../src/toolbar-icons.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"toolbar-icons.d.ts","sourceRoot":"","sources":["../src/toolbar-icons.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAiBhB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "KunEditor Vue 3 layer — the <KunEditor> component (dual WYSIWYG / markdown-source), toolbar and plugin views. Consumes @kungal/editor-core; pairs with @kungal/ui-vue.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@prosemirror-adapter/vue": "^0.4.6",
|
|
47
|
-
"@kungal/editor-core": "0.
|
|
47
|
+
"@kungal/editor-core": "0.6.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@kungal/ui-vue": "^2.7.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vite": "^8.0.16",
|
|
64
64
|
"vue": "^3.5.35",
|
|
65
65
|
"vue-tsc": "^3.3.3",
|
|
66
|
-
"@kungal/editor-core": "0.
|
|
66
|
+
"@kungal/editor-core": "0.6.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "vite build && vue-tsc -p tsconfig.build.json",
|