@kungal/editor-vue 0.16.0 → 0.18.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 CHANGED
@@ -1,5 +1,64 @@
1
1
  # @kungal/editor-vue
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6545866: Toolbar image upload now shows an in-document "uploading…" placeholder.
8
+
9
+ Previously only paste/drop showed the in-flight placeholder (Milkdown's `upload`
10
+ plugin); the toolbar image button uploaded silently — the image just popped in
11
+ when the adapter resolved. Now the toolbar path uses the same placeholder UX
12
+ (ProseMirror's official upload-example pattern).
13
+
14
+ - **editor-core**: `startImageUpload(view, file, { uploadImage, notify, locale })`
15
+ - the `imageUploadPlaceholder` decoration plugin (exported from `/preset`;
16
+ wired by the preset when `uploadImage` is present). Inserts a
17
+ `.kun-editor__uploading` widget at the caret, uploads, then replaces it with the
18
+ image (or removes it + notifies on failure); not an undo step. The paste/drop
19
+ placeholder now uses the same `.kun-editor__uploading` class so both look
20
+ identical.
21
+ - **editor-vue**: `KunEditorToolbarApi` gains `uploadImage(file)`; both the
22
+ headless `EditorToolbar` and the `#toolbar` slot API route uploads through
23
+ `startImageUpload`.
24
+ - **editor-nuxt**: `<KunEditorToolbar>`'s image button uses it.
25
+ - **Headless kept**: the placeholder is a class + widget hook only; style it via
26
+ `.kun-editor__uploading` in the reference `kun-editor.css` (primary-colored).
27
+
28
+ Customizable: style the placeholder via `.kun-editor__uploading`; the text is
29
+ localized (zh/en). Verified in the docs production build: uploading via either
30
+ toolbar inserts the image; the unit tests confirm the placeholder shows during a
31
+ pending upload and is replaced on success / removed on failure.
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [6545866]
36
+ - @kungal/editor-core@0.18.0
37
+
38
+ ## 0.17.0
39
+
40
+ ### Minor Changes
41
+
42
+ - 59abbc8: Add a placeholder (empty-state text).
43
+
44
+ - **editor-core**: `createPlaceholderPlugin({ text, mode })` — a `$prose` plugin
45
+ that adds a ProseMirror node DECORATION to the empty block (`.kun-editor__placeholder`
46
+ class + `data-placeholder` attribute). Same mechanism as Milkdown Crepe's v7
47
+ placeholder feature — purely visual (a decoration), so it never enters the doc
48
+ or the markdown output. `mode` `'block'` (default) shows on any empty block,
49
+ `'doc'` only when the whole document is empty; skipped in readonly / code blocks
50
+ / lists / tables. `createKunEditorPlugins(..., { placeholder, placeholderMode })`
51
+ wires it (only when `placeholder` is non-empty). Exported from `/preset`.
52
+ - **editor-vue**: `<KunEditor placeholder="…">` prop, threaded through.
53
+ - **Headless**: the core ships only the class + `data-placeholder` hook; render it
54
+ with `.kun-editor__placeholder::before { content: attr(data-placeholder) }` (added
55
+ to the reference `kun-editor.css`, muted via a KunUI token).
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies [59abbc8]
60
+ - @kungal/editor-core@0.17.0
61
+
3
62
  ## 0.16.0
4
63
 
5
64
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"AAmcA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"AAycA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -11,6 +11,8 @@ type __VLS_Props = {
11
11
  locale?: KunEditorLocale;
12
12
  /** Read-only render (no editing). */
13
13
  readonly?: boolean;
14
+ /** Placeholder text shown while the editor is empty. */
15
+ placeholder?: string;
14
16
  };
15
17
  type ViewMode = 'wysiwyg' | 'source';
16
18
  declare var __VLS_1: {
@@ -23,6 +25,7 @@ declare var __VLS_1: {
23
25
  }, __VLS_22: {
24
26
  run: <T>(key: import("@milkdown/kit/core").CmdKey<T>, payload?: T) => void;
25
27
  insertText: (text: string) => void;
28
+ uploadImage: (file: File) => void;
26
29
  insertQuote: (payload: {
27
30
  refId: string;
28
31
  label: string;
@@ -50,6 +53,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, KunEditorEx
50
53
  features: KunEditorFeatures;
51
54
  locale: KunEditorLocale;
52
55
  readonly: boolean;
56
+ placeholder: string;
53
57
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
54
58
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
55
59
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AAkLA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,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;AAoCJ,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;AA2MpC,QAAA,IAAI,OAAO;;iBAzMS,QAAQ;;;;;CAyMP,EAAE,QAAQ;iEAzQ/B,CArKwB;;;;;;;;;;;;;;CA8awC,CAAE;AAClE,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAClD;IAAE,OAAO,CAAC,EAAE,CAAC,KAA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G,CAAA;CAAE,GAClD;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAOhD,QAAA,MAAM,UAAU;;;;;cAtQD,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;iBAEJ,MAAM;6EAmQtB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -6,6 +6,7 @@ type __VLS_Props = {
6
6
  features: KunEditorFeatures;
7
7
  locale: KunEditorLocale;
8
8
  readonly: boolean;
9
+ placeholder: string;
9
10
  };
10
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, KunEditorExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
12
  "update:modelValue": (markdown: string) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AAwKA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAC;AA6HF,QAAA,MAAM,YAAY;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AA0KA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC;AA8HF,QAAA,MAAM,YAAY;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,6 +2,7 @@ import type { CmdKey } from '@milkdown/kit/core';
2
2
  declare var __VLS_1: {
3
3
  run: <T>(key: CmdKey<T>, payload?: T) => void;
4
4
  insertText: (text: string) => void;
5
+ uploadImage: (file: File) => void;
5
6
  insertQuote: (payload: {
6
7
  refId: string;
7
8
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"AAyEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAuEhD,QAAA,IAAI,OAAO;oCAxEX,CA9De;;;;;;;;;;;;;;CAsIO,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU,+QACd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"AAyFA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAuFhD,QAAA,IAAI,OAAO;oCAxFX,CA9Ee;;;;;;;;;;;;;;;CAsKO,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU,+QACd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
package/dist/index.js CHANGED
@@ -4,33 +4,33 @@ import { ProsemirrorAdapterProvider as k, usePluginViewContext as A, usePluginVi
4
4
  import { Editor as M, defaultValueCtx as N, editorViewCtx as P, editorViewOptionsCtx as F, rootCtx as I } from "@milkdown/kit/core";
5
5
  import { listenerCtx as L } from "@milkdown/kit/plugin/listener";
6
6
  import { SlashProvider as ee, slashFactory as te } from "@milkdown/kit/plugin/slash";
7
- import { callCommand as R, replaceAll as z } from "@milkdown/kit/utils";
8
- import { createKunEditorPlugins as ne, insertKunSpoilerCommand as re, insertMentionCommand as B, insertQuoteCommand as V, kunCM as ie, mentionId as ae, setHeadingCommand as oe } from "@kungal/editor-core/preset";
9
- import { TextSelection as se } from "@milkdown/kit/prose/state";
10
- import { createCodeBlockCommand as ce, insertHrCommand as H, insertImageCommand as U, toggleEmphasisCommand as W, toggleInlineCodeCommand as G, toggleStrongCommand as le, wrapInBlockquoteCommand as ue, wrapInBulletListCommand as de, wrapInOrderedListCommand as fe } from "@milkdown/kit/preset/commonmark";
11
- import { toggleStrikethroughCommand as pe } from "@milkdown/kit/preset/gfm";
12
- import { EditorState as me } from "@codemirror/state";
7
+ import { callCommand as R, replaceAll as ne } from "@milkdown/kit/utils";
8
+ import { createKunEditorPlugins as re, insertKunSpoilerCommand as ie, insertMentionCommand as z, insertQuoteCommand as B, kunCM as ae, mentionId as oe, setHeadingCommand as se, startImageUpload as V } from "@kungal/editor-core/preset";
9
+ import { TextSelection as ce } from "@milkdown/kit/prose/state";
10
+ import { createCodeBlockCommand as H, insertHrCommand as U, insertImageCommand as W, toggleEmphasisCommand as G, toggleInlineCodeCommand as le, toggleStrongCommand as ue, wrapInBlockquoteCommand as de, wrapInBulletListCommand as fe, wrapInOrderedListCommand as pe } from "@milkdown/kit/preset/commonmark";
11
+ import { toggleStrikethroughCommand as me } from "@milkdown/kit/preset/gfm";
12
+ import { EditorState as he } from "@codemirror/state";
13
13
  import { EditorView as K } from "@codemirror/view";
14
- import { markdown as he } from "@codemirror/lang-markdown";
15
- import { basicSetup as ge } from "codemirror";
14
+ import { markdown as ge } from "@codemirror/lang-markdown";
15
+ import { basicSetup as _e } from "codemirror";
16
16
  //#region src/context.ts
17
- var q = Symbol("kun-editor-context"), _e = [
17
+ var q = Symbol("kun-editor-context"), ve = [
18
18
  "data-active",
19
19
  "onMousedown",
20
20
  "onMouseenter"
21
- ], ve = ["src", "alt"], ye = {
21
+ ], ye = ["src", "alt"], be = {
22
22
  key: 1,
23
23
  class: "kun-mention-dropdown__avatar kun-mention-dropdown__avatar--fallback"
24
- }, be = { class: "kun-mention-dropdown__name" }, xe = {
24
+ }, xe = { class: "kun-mention-dropdown__name" }, Se = {
25
25
  key: 1,
26
26
  class: "kun-mention-dropdown__hint"
27
- }, Se = {
27
+ }, Ce = {
28
28
  key: 2,
29
29
  class: "kun-mention-dropdown__hint"
30
- }, Ce = {
30
+ }, we = {
31
31
  key: 3,
32
32
  class: "kun-mention-dropdown__hint"
33
- }, we = /* @__PURE__ */ s({
33
+ }, Te = /* @__PURE__ */ s({
34
34
  __name: "MentionDropdown",
35
35
  setup(n) {
36
36
  let r = /(?:^|\s)@([^\s@]{0,30})$/, o = l(q), s = o?.adapters.searchMentionUsers, c = t(() => (o?.locale ?? "zh-cn").toLowerCase().startsWith("en")), u = t(() => c.value ? {
@@ -73,13 +73,13 @@ var q = Symbol("kun-editor-context"), _e = [
73
73
  }, I = (e) => {
74
74
  let t = m.value;
75
75
  if (!t || !O) return;
76
- let n = t.state.schema.nodes[ae];
76
+ let n = t.state.schema.nodes[oe];
77
77
  if (!n) return;
78
78
  let r = n.create({
79
79
  userId: e.id,
80
80
  name: e.name
81
81
  }), { from: i, to: a } = O, o = t.state.tr.replaceWith(i, a, r), s = i + r.nodeSize;
82
- o.insertText(" ", s), o.setSelection(se.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
82
+ o.insertText(" ", s), o.setSelection(ce.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
83
83
  }, L = (e) => {
84
84
  if (!S.value || !T.value.length) {
85
85
  S.value && e.key === "Escape" && (e.preventDefault(), b.hide());
@@ -136,16 +136,17 @@ var q = Symbol("kun-editor-context"), _e = [
136
136
  src: e.avatar,
137
137
  alt: e.name,
138
138
  class: "kun-mention-dropdown__avatar"
139
- }, null, 8, ve)) : (p(), i("span", ye, v(e.name.charAt(0)), 1)), a("span", be, v(e.name), 1)], 40, _e))), 128)) : D.value ? (p(), i("div", xe, v(u.value.searching), 1)) : C.value ? (p(), i("div", Se, v(u.value.empty), 1)) : (p(), i("div", Ce, v(u.value.prompt), 1))], 512));
139
+ }, null, 8, ye)) : (p(), i("span", be, v(e.name.charAt(0)), 1)), a("span", xe, v(e.name), 1)], 40, ve))), 128)) : D.value ? (p(), i("div", Se, v(u.value.searching), 1)) : C.value ? (p(), i("div", Ce, v(u.value.empty), 1)) : (p(), i("div", we, v(u.value.prompt), 1))], 512));
140
140
  }
141
- }), Te = /* @__PURE__ */ s({
141
+ }), Ee = /* @__PURE__ */ s({
142
142
  __name: "MilkdownEditor",
143
143
  props: {
144
144
  modelValue: {},
145
145
  adapters: {},
146
146
  features: {},
147
147
  locale: {},
148
- readonly: { type: Boolean }
148
+ readonly: { type: Boolean },
149
+ placeholder: {}
149
150
  },
150
151
  emits: ["update:modelValue"],
151
152
  setup(e, { expose: t, emit: r }) {
@@ -156,22 +157,25 @@ var q = Symbol("kun-editor-context"), _e = [
156
157
  }), t.update(F, (e) => ({
157
158
  ...e,
158
159
  editable: () => !i.readonly
159
- })), l && t.set(c.key, { view: s({ component: we }) });
160
- }).use(ne(i.adapters, i.features, { locale: i.locale }));
160
+ })), l && t.set(c.key, { view: s({ component: Te }) });
161
+ }).use(re(i.adapters, i.features, {
162
+ locale: i.locale,
163
+ placeholder: i.placeholder
164
+ }));
161
165
  return l && t.use(c), t;
162
166
  });
163
167
  x(() => i.modelValue, (e) => {
164
- e !== o && (o = e, u.get()?.action(z(e)));
168
+ e !== o && (o = e, u.get()?.action(ne(e)));
165
169
  });
166
170
  let d = () => {
167
171
  u.get()?.action((e) => e.get(P).focus());
168
172
  };
169
173
  return t({
170
174
  insertQuote: (e) => {
171
- u.get()?.action(R(V.key, e)), d();
175
+ u.get()?.action(R(B.key, e)), d();
172
176
  },
173
177
  insertMention: (e) => {
174
- u.get()?.action(R(B.key, e)), d();
178
+ u.get()?.action(R(z.key, e)), d();
175
179
  },
176
180
  focus: d
177
181
  }), (e, t) => (p(), n(y(T)));
@@ -193,21 +197,21 @@ var q = Symbol("kun-editor-context"), _e = [
193
197
  spoiler: J("<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\"/>"),
194
198
  latex: Y("Σ", 15),
195
199
  smile: J("<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\"/>")
196
- }, Z = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), Ee = [
200
+ }, Z = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), De = [
197
201
  "title",
198
202
  "aria-label",
199
203
  "aria-expanded"
200
- ], De = ["innerHTML"], Oe = { class: "kun-editor__picker-panel" }, ke = {
204
+ ], Oe = ["innerHTML"], ke = { class: "kun-editor__picker-panel" }, Ae = {
201
205
  key: 0,
202
206
  class: "kun-editor__picker-tabs",
203
207
  role: "tablist"
204
- }, Ae = ["data-active"], je = ["data-active"], Me = { class: "kun-editor__emoji-grid" }, Ne = ["onClick"], Pe = {
208
+ }, je = ["data-active"], Me = ["data-active"], Ne = { class: "kun-editor__emoji-grid" }, Pe = ["onClick"], Fe = {
205
209
  key: 1,
206
210
  class: "kun-editor__sticker-body"
207
- }, Fe = { class: "kun-editor__pack-name" }, Ie = { class: "kun-editor__sticker-grid" }, Le = ["title", "onClick"], Re = ["src", "alt"], ze = {
211
+ }, Ie = { class: "kun-editor__pack-name" }, Le = { class: "kun-editor__sticker-grid" }, Re = ["title", "onClick"], ze = ["src", "alt"], Be = {
208
212
  key: 1,
209
213
  class: "kun-editor__picker-hint"
210
- }, Be = /* @__PURE__ */ s({
214
+ }, Ve = /* @__PURE__ */ s({
211
215
  __name: "StickerPicker",
212
216
  setup(n) {
213
217
  let [, o] = O(), s = l(q), c = s?.adapters.stickerSource, u = !!c, m = t(() => (s?.locale ?? "zh-cn").toLowerCase().startsWith("en")), _ = t(() => m.value ? {
@@ -243,7 +247,7 @@ var q = Symbol("kun-editor-context"), _e = [
243
247
  n.dispatch(r.tr.insertText(e, r.selection.from));
244
248
  });
245
249
  }, N = (e, t) => {
246
- o()?.action(R(U.key, {
250
+ o()?.action(R(W.key, {
247
251
  src: e,
248
252
  title: t,
249
253
  alt: t
@@ -263,28 +267,28 @@ var q = Symbol("kun-editor-context"), _e = [
263
267
  }, [a("span", {
264
268
  class: "kun-editor__icon",
265
269
  innerHTML: y(X).smile
266
- }, null, 8, De)], 8, Ee), C(a("div", Oe, [
267
- u ? (p(), i("div", ke, [a("button", {
270
+ }, null, 8, Oe)], 8, De), C(a("div", ke, [
271
+ u ? (p(), i("div", Ae, [a("button", {
268
272
  type: "button",
269
273
  class: "kun-editor__picker-tab",
270
274
  "data-active": w.value === "emoji",
271
275
  onClick: n[0] ||= (e) => w.value = "emoji"
272
- }, v(_.value.emoji), 9, Ae), a("button", {
276
+ }, v(_.value.emoji), 9, je), a("button", {
273
277
  type: "button",
274
278
  class: "kun-editor__picker-tab",
275
279
  "data-active": w.value === "sticker",
276
280
  onClick: n[1] ||= (e) => w.value = "sticker"
277
- }, v(_.value.sticker), 9, je)])) : r("", !0),
278
- C(a("div", Me, [(p(!0), i(e, null, g(y(Z), (e, t) => (p(), i("button", {
281
+ }, v(_.value.sticker), 9, Me)])) : r("", !0),
282
+ C(a("div", Ne, [(p(!0), i(e, null, g(y(Z), (e, t) => (p(), i("button", {
279
283
  key: t,
280
284
  type: "button",
281
285
  class: "kun-editor__emoji",
282
286
  onClick: (t) => M(e)
283
- }, v(e), 9, Ne))), 128))], 512), [[b, !u || w.value === "emoji"]]),
284
- u ? C((p(), i("div", Pe, [T.value.length ? (p(!0), i(e, { key: 0 }, g(T.value, (t) => (p(), i("div", {
287
+ }, v(e), 9, Pe))), 128))], 512), [[b, !u || w.value === "emoji"]]),
288
+ u ? C((p(), i("div", Fe, [T.value.length ? (p(!0), i(e, { key: 0 }, g(T.value, (t) => (p(), i("div", {
285
289
  key: t.name,
286
290
  class: "kun-editor__pack"
287
- }, [a("div", Fe, v(t.name), 1), a("div", Ie, [(p(!0), i(e, null, g(t.stickers, (e, t) => (p(), i("button", {
291
+ }, [a("div", Ie, v(t.name), 1), a("div", Le, [(p(!0), i(e, null, g(t.stickers, (e, t) => (p(), i("button", {
288
292
  key: t,
289
293
  type: "button",
290
294
  class: "kun-editor__sticker",
@@ -294,27 +298,27 @@ var q = Symbol("kun-editor-context"), _e = [
294
298
  src: e.src,
295
299
  alt: e.name,
296
300
  loading: "lazy"
297
- }, null, 8, Re)], 8, Le))), 128))])]))), 128)) : (p(), i("div", ze, v(D.value ? _.value.failed : _.value.empty), 1))], 512)), [[b, w.value === "sticker"]]) : r("", !0)
301
+ }, null, 8, ze)], 8, Re))), 128))])]))), 128)) : (p(), i("div", Be, v(D.value ? _.value.failed : _.value.empty), 1))], 512)), [[b, w.value === "sticker"]]) : r("", !0)
298
302
  ], 512), [[b, x.value]])], 512));
299
303
  }
300
- }), Ve = {
304
+ }), He = {
301
305
  class: "kun-editor__format-toolbar",
302
306
  role: "toolbar"
303
- }, He = ["aria-label"], Q = {
307
+ }, Ue = ["aria-label"], We = {
304
308
  value: "",
305
309
  disabled: "",
306
310
  selected: ""
307
- }, Ue = ["value"], We = [
311
+ }, Ge = ["value"], Ke = [
308
312
  "title",
309
313
  "aria-label",
310
314
  "onClick"
311
- ], Ge = ["innerHTML"], Ke = ["title", "aria-label"], qe = ["innerHTML"], Je = /* @__PURE__ */ s({
315
+ ], qe = ["innerHTML"], Je = ["title", "aria-label"], Ye = ["innerHTML"], Q = /* @__PURE__ */ s({
312
316
  __name: "EditorToolbar",
313
317
  setup(n) {
314
- let [, s] = O(), c = l(q), u = t(() => c?.adapters.uploadImage), d = () => c?.adapters.notify, f = t(() => c?.features.sticker !== !1), m = t(() => (c?.locale ?? "zh-cn").toLowerCase().startsWith("en")), _ = (e, t) => {
318
+ let [, s] = O(), c = l(q), u = t(() => c?.adapters.uploadImage), d = t(() => c?.features.sticker !== !1), f = t(() => (c?.locale ?? "zh-cn").toLowerCase().startsWith("en")), m = (e, t) => {
315
319
  s()?.action(R(e, t));
316
- }, b = t(() => {
317
- let e = m.value;
320
+ }, _ = t(() => {
321
+ let e = f.value;
318
322
  return {
319
323
  textSize: e ? "Text size" : "文本大小",
320
324
  bold: e ? "Bold" : "加粗",
@@ -329,8 +333,8 @@ var q = Symbol("kun-editor-context"), _e = [
329
333
  spoiler: e ? "Spoiler" : "隐藏文本",
330
334
  image: e ? "Upload image" : "上传图片"
331
335
  };
332
- }), x = t(() => {
333
- let e = m.value;
336
+ }), b = t(() => {
337
+ let e = f.value;
334
338
  return [
335
339
  "正文",
336
340
  "一级标题",
@@ -343,89 +347,86 @@ var q = Symbol("kun-editor-context"), _e = [
343
347
  level: n,
344
348
  label: e ? n === 0 ? "Paragraph" : `Heading ${n}` : t
345
349
  }));
346
- }), S = (e) => {
350
+ }), x = (e) => {
347
351
  let t = e.target;
348
- _(oe.key, Number(t.value)), t.selectedIndex = 0;
349
- }, C = t(() => [
352
+ m(se.key, Number(t.value)), t.selectedIndex = 0;
353
+ }, S = t(() => [
350
354
  [
351
355
  {
352
356
  svg: X.bold,
353
- title: b.value.bold,
354
- run: () => _(le.key)
357
+ title: _.value.bold,
358
+ run: () => m(ue.key)
355
359
  },
356
360
  {
357
361
  svg: X.italic,
358
- title: b.value.italic,
359
- run: () => _(W.key)
362
+ title: _.value.italic,
363
+ run: () => m(G.key)
360
364
  },
361
365
  {
362
366
  svg: X.strike,
363
- title: b.value.strike,
364
- run: () => _(pe.key)
367
+ title: _.value.strike,
368
+ run: () => m(me.key)
365
369
  },
366
370
  {
367
371
  svg: X.code,
368
- title: b.value.code,
369
- run: () => _(G.key)
372
+ title: _.value.code,
373
+ run: () => m(le.key)
370
374
  }
371
375
  ],
372
376
  [
373
377
  {
374
378
  svg: X.bulletList,
375
- title: b.value.bulletList,
376
- run: () => _(de.key)
379
+ title: _.value.bulletList,
380
+ run: () => m(fe.key)
377
381
  },
378
382
  {
379
383
  svg: X.orderedList,
380
- title: b.value.orderedList,
381
- run: () => _(fe.key)
384
+ title: _.value.orderedList,
385
+ run: () => m(pe.key)
382
386
  },
383
387
  {
384
388
  svg: X.quote,
385
- title: b.value.quote,
386
- run: () => _(ue.key)
389
+ title: _.value.quote,
390
+ run: () => m(de.key)
387
391
  },
388
392
  {
389
393
  svg: X.codeBlock,
390
- title: b.value.codeBlock,
391
- run: () => _(ce.key, "")
394
+ title: _.value.codeBlock,
395
+ run: () => m(H.key, "")
392
396
  },
393
397
  {
394
398
  svg: X.hr,
395
- title: b.value.hr,
396
- run: () => _(H.key)
399
+ title: _.value.hr,
400
+ run: () => m(U.key)
397
401
  }
398
402
  ],
399
403
  [{
400
404
  svg: X.spoiler,
401
- title: b.value.spoiler,
402
- run: () => _(re.key)
405
+ title: _.value.spoiler,
406
+ run: () => m(ie.key)
403
407
  }]
404
- ]), w = h(null), T = () => w.value?.click(), E = async (e) => {
408
+ ]), C = h(null), w = () => C.value?.click(), T = (e) => {
405
409
  let t = e.target, n = t.files?.[0];
406
410
  t.value = "";
407
411
  let r = u.value;
408
- if (!(!n || !r)) try {
409
- let e = await r(n);
410
- _(U.key, {
411
- src: e,
412
- title: n.name,
413
- alt: n.name
412
+ !n || !r || s()?.action((e) => {
413
+ V(e.get(P), n, {
414
+ uploadImage: r,
415
+ notify: c?.adapters.notify,
416
+ locale: c?.locale
414
417
  });
415
- } catch {
416
- d()?.(m.value ? "Image upload failed" : "图片上传失败", "error");
417
- }
418
+ });
418
419
  };
419
- return (t, n) => (p(), i("div", Ve, [
420
+ return (t, n) => (p(), i("div", He, [
420
421
  a("select", {
421
422
  class: "kun-editor__heading-select",
422
- "aria-label": b.value.textSize,
423
- onChange: S
424
- }, [a("option", Q, v(b.value.textSize), 1), (p(!0), i(e, null, g(x.value, (e) => (p(), i("option", {
423
+ "aria-label": _.value.textSize,
424
+ onChange: x
425
+ }, [a("option", We, v(_.value.textSize), 1), (p(!0), i(e, null, g(b.value, (e) => (p(), i("option", {
425
426
  key: e.level,
426
427
  value: e.level
427
- }, v(e.label), 9, Ue))), 128))], 40, He),
428
- (p(!0), i(e, null, g(C.value, (t, r) => (p(), i(e, { key: r }, [n[0] ||= a("span", {
428
+ }, v(e.label), 9, Ge))), 128))], 40, Ue),
429
+ (p(!0), i(e, null, g(S.value, (t, r) => (p(), i(e, { key: r }, [n[0] ||= a("span", {
429
430
  class: "kun-editor__toolbar-divider",
430
431
  "aria-hidden": "true"
431
432
  }, null, -1), (p(!0), i(e, null, g(t, (e, t) => (p(), i("button", {
@@ -438,7 +439,7 @@ var q = Symbol("kun-editor-context"), _e = [
438
439
  }, [a("span", {
439
440
  class: "kun-editor__icon",
440
441
  innerHTML: e.svg
441
- }, null, 8, Ge)], 8, We))), 128))], 64))), 128)),
442
+ }, null, 8, qe)], 8, Ke))), 128))], 64))), 128)),
442
443
  u.value ? (p(), i(e, { key: 0 }, [
443
444
  n[1] ||= a("span", {
444
445
  class: "kun-editor__toolbar-divider",
@@ -447,29 +448,29 @@ var q = Symbol("kun-editor-context"), _e = [
447
448
  a("button", {
448
449
  type: "button",
449
450
  class: "kun-editor__tool",
450
- title: b.value.image,
451
- "aria-label": b.value.image,
452
- onClick: T
451
+ title: _.value.image,
452
+ "aria-label": _.value.image,
453
+ onClick: w
453
454
  }, [a("span", {
454
455
  class: "kun-editor__icon",
455
456
  innerHTML: y(X).image
456
- }, null, 8, qe)], 8, Ke),
457
+ }, null, 8, Ye)], 8, Je),
457
458
  a("input", {
458
459
  ref_key: "fileInput",
459
- ref: w,
460
+ ref: C,
460
461
  type: "file",
461
462
  accept: ".jpg,.jpeg,.png,.webp,.gif",
462
463
  hidden: "",
463
- onChange: E
464
+ onChange: T
464
465
  }, null, 544)
465
466
  ], 64)) : r("", !0),
466
- f.value ? (p(), i(e, { key: 1 }, [n[2] ||= a("span", {
467
+ d.value ? (p(), i(e, { key: 1 }, [n[2] ||= a("span", {
467
468
  class: "kun-editor__toolbar-divider",
468
469
  "aria-hidden": "true"
469
- }, null, -1), o(Be)], 64)) : r("", !0)
470
+ }, null, -1), o(Ve)], 64)) : r("", !0)
470
471
  ]));
471
472
  }
472
- }), Ye = /* @__PURE__ */ s({
473
+ }), Xe = /* @__PURE__ */ s({
473
474
  __name: "ToolbarHost",
474
475
  setup(e) {
475
476
  let [, t] = O(), n = l(q, void 0), r = (e, n) => {
@@ -484,11 +485,21 @@ var q = Symbol("kun-editor-context"), _e = [
484
485
  n.dispatch(n.state.tr.insertText(e));
485
486
  }), i();
486
487
  },
488
+ uploadImage: (e) => {
489
+ let r = n?.adapters.uploadImage, i = t();
490
+ !r || !i || i.action((t) => {
491
+ V(t.get(P), e, {
492
+ uploadImage: r,
493
+ notify: n?.adapters.notify,
494
+ locale: n?.locale
495
+ });
496
+ });
497
+ },
487
498
  insertQuote: (e) => {
488
- r(V.key, e), i();
499
+ r(B.key, e), i();
489
500
  },
490
501
  insertMention: (e) => {
491
- r(B.key, e), i();
502
+ r(z.key, e), i();
492
503
  },
493
504
  focus: i,
494
505
  get adapters() {
@@ -503,7 +514,7 @@ var q = Symbol("kun-editor-context"), _e = [
503
514
  };
504
515
  return (e, t) => _(e.$slots, "default", u(c(a)));
505
516
  }
506
- }), Xe = /* @__PURE__ */ s({
517
+ }), Ze = /* @__PURE__ */ s({
507
518
  __name: "MarkdownSource",
508
519
  props: {
509
520
  modelValue: {},
@@ -511,13 +522,13 @@ var q = Symbol("kun-editor-context"), _e = [
511
522
  },
512
523
  emits: ["update:modelValue"],
513
524
  setup(e, { emit: t }) {
514
- let n = e, r = t, a = h(null), o = null, s = (e) => me.create({
525
+ let n = e, r = t, a = h(null), o = null, s = (e) => he.create({
515
526
  doc: e,
516
527
  extensions: [
517
- ie(),
528
+ ae(),
518
529
  K.lineWrapping,
519
- ge,
520
- he(),
530
+ _e,
531
+ ge(),
521
532
  K.editable.of(!n.readonly),
522
533
  K.updateListener.of((e) => {
523
534
  e.docChanged && r("update:modelValue", e.state.doc.toString());
@@ -539,13 +550,13 @@ var q = Symbol("kun-editor-context"), _e = [
539
550
  class: "kun-editor__source"
540
551
  }, null, 512));
541
552
  }
542
- }), Ze = {
553
+ }), Qe = {
543
554
  class: "kun-editor",
544
555
  "data-kun-editor": ""
545
- }, Qe = {
556
+ }, $e = {
546
557
  class: "kun-editor__toolbar",
547
558
  role: "tablist"
548
- }, $e = ["aria-selected", "data-active"], et = ["aria-selected", "data-active"], tt = { class: "kun-editor__wysiwyg" }, $ = /* @__PURE__ */ s({
559
+ }, et = ["aria-selected", "data-active"], tt = ["aria-selected", "data-active"], nt = { class: "kun-editor__wysiwyg" }, $ = /* @__PURE__ */ s({
549
560
  __name: "KunEditor",
550
561
  props: {
551
562
  modelValue: {},
@@ -555,7 +566,8 @@ var q = Symbol("kun-editor-context"), _e = [
555
566
  readonly: {
556
567
  type: Boolean,
557
568
  default: !1
558
- }
569
+ },
570
+ placeholder: { default: "" }
559
571
  },
560
572
  emits: ["update:modelValue"],
561
573
  setup(e, { expose: s, emit: l }) {
@@ -584,30 +596,30 @@ var q = Symbol("kun-editor-context"), _e = [
584
596
  insertQuote: (e) => O.value?.insertQuote(e),
585
597
  insertMention: (e) => O.value?.insertMention(e),
586
598
  focus: () => O.value?.focus()
587
- }), (t, s) => (p(), i("div", Ze, [
599
+ }), (t, s) => (p(), i("div", Qe, [
588
600
  _(t.$slots, "view-switch", {
589
601
  mode: g.value,
590
602
  setMode: x,
591
603
  labels: T.value
592
- }, () => [a("div", Qe, [a("button", {
604
+ }, () => [a("div", $e, [a("button", {
593
605
  type: "button",
594
606
  class: "kun-editor__tab",
595
607
  "aria-selected": g.value === "wysiwyg",
596
608
  "data-active": g.value === "wysiwyg",
597
609
  onClick: s[0] ||= (e) => x("wysiwyg")
598
- }, v(T.value.wysiwyg), 9, $e), a("button", {
610
+ }, v(T.value.wysiwyg), 9, et), a("button", {
599
611
  type: "button",
600
612
  class: "kun-editor__tab",
601
613
  "aria-selected": g.value === "source",
602
614
  "data-active": g.value === "source",
603
615
  onClick: s[1] ||= (e) => x("source")
604
- }, v(T.value.source), 9, et)])]),
616
+ }, v(T.value.source), 9, tt)])]),
605
617
  o(y(E), null, {
606
618
  default: S(() => [o(y(k), null, {
607
- default: S(() => [C(a("div", null, [o(Ye, null, {
608
- default: S((e) => [_(t.$slots, "toolbar", u(c(e)), () => [o(Je)])]),
619
+ default: S(() => [C(a("div", null, [o(Xe, null, {
620
+ default: S((e) => [_(t.$slots, "toolbar", u(c(e)), () => [o(Q)])]),
609
621
  _: 3
610
- })], 512), [[b, g.value === "wysiwyg" && !e.readonly]]), C(a("div", tt, [o(Te, {
622
+ })], 512), [[b, g.value === "wysiwyg" && !e.readonly]]), C(a("div", nt, [o(Ee, {
611
623
  ref_key: "inner",
612
624
  ref: O,
613
625
  "model-value": e.modelValue,
@@ -615,19 +627,21 @@ var q = Symbol("kun-editor-context"), _e = [
615
627
  features: e.features,
616
628
  locale: e.locale,
617
629
  readonly: e.readonly,
630
+ placeholder: e.placeholder,
618
631
  "onUpdate:modelValue": D
619
632
  }, null, 8, [
620
633
  "model-value",
621
634
  "adapters",
622
635
  "features",
623
636
  "locale",
624
- "readonly"
637
+ "readonly",
638
+ "placeholder"
625
639
  ])], 512), [[b, g.value === "wysiwyg"]])]),
626
640
  _: 3
627
641
  })]),
628
642
  _: 3
629
643
  }),
630
- g.value === "source" ? (p(), n(Xe, {
644
+ g.value === "source" ? (p(), n(Ze, {
631
645
  key: 0,
632
646
  "model-value": e.modelValue,
633
647
  readonly: e.readonly,
@@ -635,8 +649,8 @@ var q = Symbol("kun-editor-context"), _e = [
635
649
  }, null, 8, ["model-value", "readonly"])) : r("", !0)
636
650
  ]));
637
651
  }
638
- }), nt = { install(e) {
652
+ }), rt = { install(e) {
639
653
  e.component("KunEditor", $);
640
654
  } };
641
655
  //#endregion
642
- export { Z as EMOJI, $ as KunEditor, nt as KunEditorPlugin };
656
+ export { Z as EMOJI, $ as KunEditor, rt as KunEditorPlugin };
package/dist/types.d.ts CHANGED
@@ -5,6 +5,12 @@ export interface KunEditorToolbarApi {
5
5
  run: <T>(key: CmdKey<T>, payload?: T) => void;
6
6
  /** Insert plain text at the cursor (e.g. an emoji). */
7
7
  insertText: (text: string) => void;
8
+ /**
9
+ * Upload an image File via the `uploadImage` adapter, showing an in-document
10
+ * "uploading…" placeholder at the caret until it resolves (then the image), or
11
+ * removing it + notifying on failure. No-op without an `uploadImage` adapter.
12
+ */
13
+ uploadImage: (file: File) => void;
8
14
  /** Insert a reference atom at the cursor (requires the quote feature). */
9
15
  insertQuote: (payload: {
10
16
  refId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAM5B,MAAM,WAAW,mBAAmB;IAClC,8EAA8E;IAC9E,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,IAAI,CAAA;IAC7C,uDAAuD;IACvD,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,0EAA0E;IAC1E,WAAW,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAChE,6CAA6C;IAC7C,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IA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A;IAC9D,gCAAgC;IAChC,KAAK,IAAI,IAAI,CAAA;CACd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-vue",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "KunEditor Vue 3 layer — the headless <KunEditor> component (dual WYSIWYG / markdown-source), toolbar and plugin views. Ships zero CSS and no UI-kit dependency; consumes @kungal/editor-core, and pairs with @kungal/editor-nuxt for optional KunUI chrome.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@prosemirror-adapter/vue": "^0.4.6",
43
- "@kungal/editor-core": "0.16.0"
43
+ "@kungal/editor-core": "0.18.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@codemirror/lang-markdown": "^6.0.0",
@@ -80,7 +80,7 @@
80
80
  "vite": "^8.0.16",
81
81
  "vue": "^3.5.35",
82
82
  "vue-tsc": "^3.3.3",
83
- "@kungal/editor-core": "0.16.0"
83
+ "@kungal/editor-core": "0.18.0"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "vite build && vue-tsc -p tsconfig.build.json",