@kungal/editor-vue 0.18.0 → 0.20.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,71 @@
1
1
  # @kungal/editor-vue
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 62e14f5: Split view: sync scrolling between the panes, with an off switch.
8
+
9
+ Scrolling the markdown source pane now scrolls the WYSIWYG preview to the same
10
+ position (and vice-versa) — proportional/percentage sync (source↔preview line
11
+ mapping is impractical across two separate renderers), with an active-pane +
12
+ idle-timeout guard so the echoed scroll doesn't feed back into a loop.
13
+
14
+ Turn it off two ways (for downstream customization):
15
+
16
+ - **`scrollSync` prop** on `<KunEditor>` (default `true`) — pass
17
+ `:scroll-sync="false"` to disable entirely.
18
+ - **A runtime toggle** in the view switch: `KunEditorViewSwitchApi` gains
19
+ `scrollSync` / `toggleScrollSync()` (+ `labels.scrollSync`). The default view
20
+ switch shows a 同步滚动 toggle in split mode; `<KunEditorViewSwitch>` (editor-nuxt)
21
+ shows a KunUI link/unlink toggle button. Or replace the whole control via the
22
+ `#view-switch` slot.
23
+
24
+ Sync needs each pane to scroll internally, so the reference `kun-editor.css` now
25
+ gives split panes a bounded height (`--kun-editor-split-height`, default `60vh`,
26
+ overridable) with `overflow: auto`. editor-vue still ships zero CSS.
27
+
28
+ Verified in the docs production build (headless + KunUI view switches): with the
29
+ panes overflowing, scrolling the source drives the preview to the same ratio;
30
+ toggling off makes them scroll independently; toggling on resumes; 0 console
31
+ errors.
32
+
33
+ ### Patch Changes
34
+
35
+ - @kungal/editor-core@0.20.0
36
+
37
+ ## 0.19.0
38
+
39
+ ### Minor Changes
40
+
41
+ - f111b82: Add a desktop **split view** for long-form writing.
42
+
43
+ `<KunEditor>` now has a third view mode, `split`, alongside WYSIWYG and Markdown:
44
+ an editable markdown source pane + a live **read-only WYSIWYG preview**, side by
45
+ side and left/right swappable. The markdown string stays the single source of
46
+ truth and the preview is derived — the industry-standard model (VS Code /
47
+ StackEdit / Dillinger), so there's no two-editor bidirectional-sync problem.
48
+
49
+ - **editor-vue**: the view mode gains `'split'`; `KunEditorViewSwitchApi` gains
50
+ `swap()` / `swapped` and `labels.split` / `labels.swap`. The WYSIWYG becomes a
51
+ read-only preview in split (its editability now reacts to the `readonly` prop).
52
+ The default hand-rolled view switch gets a 分栏 tab + a ⇄ swap button.
53
+ - **editor-nuxt**: `<KunEditorViewSwitch>` gets the 分栏 KunTab + a KunUI swap
54
+ button (shown in split).
55
+ - **Headless**: the layout is class hooks only — `.kun-editor__panes` /
56
+ `.kun-editor__pane` under `[data-mode='split']` (+ `[data-swap]`). Styled by the
57
+ reference `kun-editor.css`: stacked on narrow screens, side-by-side (swappable)
58
+ from `md` up. editor-vue still ships zero CSS.
59
+
60
+ Verified in the docs production build (headless + KunUI view switches): 分栏 shows
61
+ both panes side by side, typing markdown in the source updates the preview live,
62
+ the WYSIWYG preview is `contenteditable=false`, swap reverses the panes; 0 console
63
+ errors. (Synced scrolling between panes is a possible follow-up.)
64
+
65
+ ### Patch Changes
66
+
67
+ - @kungal/editor-core@0.19.0
68
+
3
69
  ## 0.18.0
4
70
 
5
71
  ### Minor Changes
@@ -13,15 +13,25 @@ type __VLS_Props = {
13
13
  readonly?: boolean;
14
14
  /** Placeholder text shown while the editor is empty. */
15
15
  placeholder?: string;
16
+ /** Sync scrolling between the split panes. Default `true`; set `false` to
17
+ * disable (or toggle it at runtime via the view-switch API). */
18
+ scrollSync?: boolean;
16
19
  };
17
- type ViewMode = 'wysiwyg' | 'source';
20
+ type ViewMode = 'wysiwyg' | 'source' | 'split';
18
21
  declare var __VLS_1: {
19
22
  mode: ViewMode;
20
23
  setMode: (m: ViewMode) => void;
21
24
  labels: {
22
25
  wysiwyg: string;
23
26
  source: string;
27
+ split: string;
28
+ swap: string;
29
+ scrollSync: string;
24
30
  };
31
+ swapped: boolean;
32
+ swap: () => void;
33
+ scrollSync: boolean;
34
+ toggleScrollSync: () => void;
25
35
  }, __VLS_22: {
26
36
  run: <T>(key: import("@milkdown/kit/core").CmdKey<T>, payload?: T) => void;
27
37
  insertText: (text: string) => void;
@@ -54,6 +64,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, KunEditorEx
54
64
  locale: KunEditorLocale;
55
65
  readonly: boolean;
56
66
  placeholder: string;
67
+ scrollSync: boolean;
57
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
69
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
59
70
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AAsLA,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;IAClB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC;AAqCJ,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;AA8MpC,QAAA,IAAI,OAAO;;iBA5MS,QAAQ;;;;;CA4MP,EAAE,QAAQ;iEA/Q/B,CAzKwB;;;;;;;;;;;;;;;CAwbwC,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,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"}
1
+ {"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AA6TA,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;IAClB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;oEACgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAC;AAsCJ,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAsW9C,QAAA,IAAI,OAAO;;iBApWS,QAAQ;;;;;;;;;;;;CAoWP,EAAE,QAAQ;iEA3a/B,CAjTuE;;;;;;;;;;;;;;;CA4tBP,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,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAQhD,QAAA,MAAM,UAAU;;;;;cAnaD,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;iBAEJ,MAAM;gBAGP,OAAO;6EA6ZtB,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"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AAwLA,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;AA4IF,QAAA,MAAM,YAAY;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
package/dist/index.js CHANGED
@@ -1,39 +1,39 @@
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, guardReactiveProps as c, inject as l, normalizeProps as u, onBeforeUnmount as d, onMounted as f, openBlock as p, provide as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, vShow as b, watch as x, withCtx as S, withDirectives as C, withModifiers as w } from "vue";
2
- import { Milkdown as T, MilkdownProvider as E, useEditor as D, useInstance as O } from "@milkdown/vue";
3
- import { ProsemirrorAdapterProvider as k, usePluginViewContext as A, usePluginViewFactory as j } from "@prosemirror-adapter/vue";
4
- import { Editor as M, defaultValueCtx as N, editorViewCtx as P, editorViewOptionsCtx as F, rootCtx as I } from "@milkdown/kit/core";
5
- import { listenerCtx as L } from "@milkdown/kit/plugin/listener";
6
- import { SlashProvider as ee, slashFactory as te } from "@milkdown/kit/plugin/slash";
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
- import { EditorView as K } from "@codemirror/view";
14
- import { markdown as ge } from "@codemirror/lang-markdown";
15
- import { basicSetup as _e } from "codemirror";
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, guardReactiveProps as c, inject as l, nextTick as u, normalizeProps as d, onBeforeUnmount as f, onMounted as p, openBlock as m, provide as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, vShow as x, watch as S, withCtx as C, withDirectives as w, withModifiers as T } from "vue";
2
+ import { Milkdown as E, MilkdownProvider as D, useEditor as O, useInstance as k } from "@milkdown/vue";
3
+ import { ProsemirrorAdapterProvider as A, usePluginViewContext as j, usePluginViewFactory as M } from "@prosemirror-adapter/vue";
4
+ import { Editor as N, defaultValueCtx as P, editorViewCtx as F, editorViewOptionsCtx as I, rootCtx as L } from "@milkdown/kit/core";
5
+ import { listenerCtx as R } from "@milkdown/kit/plugin/listener";
6
+ import { SlashProvider as z, slashFactory as B } from "@milkdown/kit/plugin/slash";
7
+ import { callCommand as V, replaceAll as H } from "@milkdown/kit/utils";
8
+ import { createKunEditorPlugins as U, insertKunSpoilerCommand as W, insertMentionCommand as G, insertQuoteCommand as K, kunCM as ee, mentionId as te, setHeadingCommand as ne, startImageUpload as q } from "@kungal/editor-core/preset";
9
+ import { TextSelection as re } from "@milkdown/kit/prose/state";
10
+ import { createCodeBlockCommand as ie, insertHrCommand as ae, insertImageCommand as oe, toggleEmphasisCommand as se, toggleInlineCodeCommand as ce, 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";
13
+ import { EditorView as J } from "@codemirror/view";
14
+ import { markdown as he } from "@codemirror/lang-markdown";
15
+ import { basicSetup as ge } from "codemirror";
16
16
  //#region src/context.ts
17
- var q = Symbol("kun-editor-context"), ve = [
17
+ var Y = Symbol("kun-editor-context"), _e = [
18
18
  "data-active",
19
19
  "onMousedown",
20
20
  "onMouseenter"
21
- ], ye = ["src", "alt"], be = {
21
+ ], ve = ["src", "alt"], ye = {
22
22
  key: 1,
23
23
  class: "kun-mention-dropdown__avatar kun-mention-dropdown__avatar--fallback"
24
- }, xe = { class: "kun-mention-dropdown__name" }, Se = {
24
+ }, be = { class: "kun-mention-dropdown__name" }, xe = {
25
25
  key: 1,
26
26
  class: "kun-mention-dropdown__hint"
27
- }, Ce = {
27
+ }, Se = {
28
28
  key: 2,
29
29
  class: "kun-mention-dropdown__hint"
30
- }, we = {
30
+ }, Ce = {
31
31
  key: 3,
32
32
  class: "kun-mention-dropdown__hint"
33
- }, Te = /* @__PURE__ */ s({
33
+ }, we = /* @__PURE__ */ s({
34
34
  __name: "MentionDropdown",
35
35
  setup(n) {
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 ? {
36
+ let r = /(?:^|\s)@([^\s@]{0,30})$/, o = l(Y), s = o?.adapters.searchMentionUsers, c = t(() => (o?.locale ?? "zh-cn").toLowerCase().startsWith("en")), u = t(() => c.value ? {
37
37
  searching: "Searching…",
38
38
  empty: "No matching users",
39
39
  prompt: "Type a username to search"
@@ -41,21 +41,21 @@ var q = Symbol("kun-editor-context"), ve = [
41
41
  searching: "搜索中…",
42
42
  empty: "无匹配用户",
43
43
  prompt: "输入用户名以搜索"
44
- }), { view: m, prevState: _ } = A(), y = h(null), b, S = h(!1), C = h(""), T = h([]), E = h(0), D = h(!1), O = null, k = 0, j = null, M = () => {
45
- j &&= (clearTimeout(j), null), C.value = "", T.value = [], E.value = 0, D.value = !1, O = null;
44
+ }), { view: d, prevState: h } = j(), v = g(null), b, x = g(!1), C = g(""), w = g([]), E = g(0), D = g(!1), O = null, k = 0, A = null, M = () => {
45
+ A &&= (clearTimeout(A), null), C.value = "", w.value = [], E.value = 0, D.value = !1, O = null;
46
46
  }, N = (e) => {
47
- if (j &&= (clearTimeout(j), null), !e || !s) {
48
- T.value = [], D.value = !1;
47
+ if (A &&= (clearTimeout(A), null), !e || !s) {
48
+ w.value = [], D.value = !1;
49
49
  return;
50
50
  }
51
- D.value = !0, j = setTimeout(async () => {
51
+ D.value = !0, A = setTimeout(async () => {
52
52
  let t = ++k, n = [];
53
53
  try {
54
54
  n = await s(e);
55
55
  } catch {
56
56
  n = [];
57
57
  }
58
- t === k && (T.value = n ?? [], E.value = 0, D.value = !1);
58
+ t === k && (w.value = n ?? [], E.value = 0, D.value = !1);
59
59
  }, 180);
60
60
  }, P = (e) => {
61
61
  let { selection: t } = e.state;
@@ -71,21 +71,21 @@ var q = Symbol("kun-editor-context"), ve = [
71
71
  to: n
72
72
  }, t !== C.value && (C.value = t, N(t)), !0;
73
73
  }, I = (e) => {
74
- let t = m.value;
74
+ let t = d.value;
75
75
  if (!t || !O) return;
76
- let n = t.state.schema.nodes[oe];
76
+ let n = t.state.schema.nodes[te];
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(ce.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
82
+ o.insertText(" ", s), o.setSelection(re.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
83
83
  }, L = (e) => {
84
- if (!S.value || !T.value.length) {
85
- S.value && e.key === "Escape" && (e.preventDefault(), b.hide());
84
+ if (!x.value || !w.value.length) {
85
+ x.value && e.key === "Escape" && (e.preventDefault(), b.hide());
86
86
  return;
87
87
  }
88
- let t = T.value.length - 1;
88
+ let t = w.value.length - 1;
89
89
  switch (e.key) {
90
90
  case "ArrowDown":
91
91
  e.preventDefault(), e.stopPropagation(), E.value = E.value >= t ? 0 : E.value + 1;
@@ -95,7 +95,7 @@ var q = Symbol("kun-editor-context"), ve = [
95
95
  break;
96
96
  case "Enter":
97
97
  case "Tab": {
98
- let t = T.value[E.value];
98
+ let t = w.value[E.value];
99
99
  t && (e.preventDefault(), e.stopPropagation(), I(t));
100
100
  break;
101
101
  }
@@ -104,41 +104,41 @@ var q = Symbol("kun-editor-context"), ve = [
104
104
  break;
105
105
  }
106
106
  };
107
- return f(() => {
108
- b = new ee({
109
- content: y.value,
107
+ return p(() => {
108
+ b = new z({
109
+ content: v.value,
110
110
  trigger: "@",
111
111
  shouldShow: F,
112
112
  debounce: 0
113
113
  }), b.onShow = () => {
114
- S.value = !0;
114
+ x.value = !0;
115
115
  }, b.onHide = () => {
116
- S.value = !1, M();
117
- }, b.update(m.value, _.value), window.addEventListener("keydown", L, !0);
118
- }), x([m, _], () => {
119
- b?.update(m.value, _.value);
120
- }), d(() => {
121
- j && clearTimeout(j), window.removeEventListener("keydown", L, !0), b?.destroy();
122
- }), (t, n) => (p(), i("div", {
116
+ x.value = !1, M();
117
+ }, b.update(d.value, h.value), window.addEventListener("keydown", L, !0);
118
+ }), S([d, h], () => {
119
+ b?.update(d.value, h.value);
120
+ }), f(() => {
121
+ A && clearTimeout(A), window.removeEventListener("keydown", L, !0), b?.destroy();
122
+ }), (t, n) => (m(), i("div", {
123
123
  ref_key: "divRef",
124
- ref: y,
124
+ ref: v,
125
125
  class: "kun-mention-dropdown",
126
126
  "data-show": "false"
127
- }, [T.value.length ? (p(!0), i(e, { key: 0 }, g(T.value, (e, t) => (p(), i("button", {
127
+ }, [w.value.length ? (m(!0), i(e, { key: 0 }, _(w.value, (e, t) => (m(), i("button", {
128
128
  key: e.id,
129
129
  type: "button",
130
130
  class: "kun-mention-dropdown__item",
131
131
  "data-active": t === E.value,
132
- onMousedown: w((t) => I(e), ["prevent"]),
132
+ onMousedown: T((t) => I(e), ["prevent"]),
133
133
  onMouseenter: (e) => E.value = t
134
- }, [e.avatar ? (p(), i("img", {
134
+ }, [e.avatar ? (m(), i("img", {
135
135
  key: 0,
136
136
  src: e.avatar,
137
137
  alt: e.name,
138
138
  class: "kun-mention-dropdown__avatar"
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));
139
+ }, null, 8, ve)) : (m(), i("span", ye, y(e.name.charAt(0)), 1)), a("span", be, y(e.name), 1)], 40, _e))), 128)) : D.value ? (m(), i("div", xe, y(u.value.searching), 1)) : C.value ? (m(), i("div", Se, y(u.value.empty), 1)) : (m(), i("div", Ce, y(u.value.prompt), 1))], 512));
140
140
  }
141
- }), Ee = /* @__PURE__ */ s({
141
+ }), Te = /* @__PURE__ */ s({
142
142
  __name: "MilkdownEditor",
143
143
  props: {
144
144
  modelValue: {},
@@ -150,71 +150,76 @@ var q = Symbol("kun-editor-context"), ve = [
150
150
  },
151
151
  emits: ["update:modelValue"],
152
152
  setup(e, { expose: t, emit: r }) {
153
- let i = e, a = r, o = i.modelValue, s = j(), c = te("kunMention"), l = i.features.mention !== !1 && !!i.adapters.searchMentionUsers && !!s, u = D((e) => {
154
- let t = M.make().config((t) => {
155
- t.set(I, e), t.set(N, i.modelValue), t.get(L).markdownUpdated((e, t, n) => {
153
+ let i = e, a = r, o = i.modelValue, s = M(), c = B("kunMention"), l = i.features.mention !== !1 && !!i.adapters.searchMentionUsers && !!s, u = O((e) => {
154
+ let t = N.make().config((t) => {
155
+ t.set(L, e), t.set(P, i.modelValue), t.get(R).markdownUpdated((e, t, n) => {
156
156
  t !== n && (o = t, a("update:modelValue", t));
157
- }), t.update(F, (e) => ({
157
+ }), t.update(I, (e) => ({
158
158
  ...e,
159
159
  editable: () => !i.readonly
160
- })), l && t.set(c.key, { view: s({ component: Te }) });
161
- }).use(re(i.adapters, i.features, {
160
+ })), l && t.set(c.key, { view: s({ component: we }) });
161
+ }).use(U(i.adapters, i.features, {
162
162
  locale: i.locale,
163
163
  placeholder: i.placeholder
164
164
  }));
165
165
  return l && t.use(c), t;
166
166
  });
167
- x(() => i.modelValue, (e) => {
168
- e !== o && (o = e, u.get()?.action(ne(e)));
167
+ S(() => i.modelValue, (e) => {
168
+ e !== o && (o = e, u.get()?.action(H(e)));
169
+ }), S(() => i.readonly, () => {
170
+ u.get()?.action((e) => {
171
+ let t = e.get(F);
172
+ t.dispatch(t.state.tr);
173
+ });
169
174
  });
170
175
  let d = () => {
171
- u.get()?.action((e) => e.get(P).focus());
176
+ u.get()?.action((e) => e.get(F).focus());
172
177
  };
173
178
  return t({
174
179
  insertQuote: (e) => {
175
- u.get()?.action(R(B.key, e)), d();
180
+ u.get()?.action(V(K.key, e)), d();
176
181
  },
177
182
  insertMention: (e) => {
178
- u.get()?.action(R(z.key, e)), d();
183
+ u.get()?.action(V(G.key, e)), d();
179
184
  },
180
185
  focus: d
181
- }), (e, t) => (p(), n(y(T)));
186
+ }), (e, t) => (m(), n(b(E)));
182
187
  }
183
- }), J = (e) => `<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`, Y = (e, t = 13) => `<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><text x="12" y="12" dominant-baseline="central" text-anchor="middle" font-size="${t}" font-weight="700" font-family="ui-sans-serif, system-ui, sans-serif" fill="currentColor">${e}</text></svg>`, X = {
184
- bold: J("<path d=\"M6 4h8a4 4 0 0 1 0 8H6z\"/><path d=\"M6 12h9a4 4 0 0 1 0 8H6z\"/>"),
185
- italic: J("<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"/><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"/><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"/>"),
186
- strike: J("<path d=\"M16 4H9a3 3 0 0 0-2.83 4\"/><path d=\"M14 12a4 4 0 0 1 0 8H6\"/><line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\"/>"),
187
- code: J("<path d=\"m18 16 4-4-4-4\"/><path d=\"m6 8-4 4 4 4\"/><path d=\"m14.5 4-5 16\"/>"),
188
- h1: Y("H1", 11),
189
- h2: Y("H2", 11),
190
- h3: Y("H3", 11),
191
- bulletList: J("<line x1=\"8\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"8\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"8\" y1=\"18\" x2=\"21\" y2=\"18\"/><circle cx=\"3.5\" cy=\"6\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"3.5\" cy=\"12\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"3.5\" cy=\"18\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/>"),
192
- orderedList: J("<line x1=\"10\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"10\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"10\" y1=\"18\" x2=\"21\" y2=\"18\"/><path d=\"M4 6h1v4\"/><path d=\"M4 10h2\"/><path d=\"M6 18H4c0-1 2-1.5 2-2.5S5 14 4 14.5\"/>"),
193
- quote: J("<path d=\"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z\" fill=\"currentColor\" stroke=\"none\"/>"),
194
- codeBlock: J("<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"m9 10-2 2 2 2\"/><path d=\"m15 10 2 2-2 2\"/>"),
195
- hr: J("<line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\"/>"),
196
- image: J("<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\"/>"),
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\"/>"),
198
- latex: Y("Σ", 15),
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\"/>")
200
- }, Z = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), De = [
188
+ }), X = (e) => `<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`, Z = (e, t = 13) => `<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><text x="12" y="12" dominant-baseline="central" text-anchor="middle" font-size="${t}" font-weight="700" font-family="ui-sans-serif, system-ui, sans-serif" fill="currentColor">${e}</text></svg>`, Q = {
189
+ bold: X("<path d=\"M6 4h8a4 4 0 0 1 0 8H6z\"/><path d=\"M6 12h9a4 4 0 0 1 0 8H6z\"/>"),
190
+ italic: X("<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"/><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"/><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"/>"),
191
+ strike: X("<path d=\"M16 4H9a3 3 0 0 0-2.83 4\"/><path d=\"M14 12a4 4 0 0 1 0 8H6\"/><line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\"/>"),
192
+ code: X("<path d=\"m18 16 4-4-4-4\"/><path d=\"m6 8-4 4 4 4\"/><path d=\"m14.5 4-5 16\"/>"),
193
+ h1: Z("H1", 11),
194
+ h2: Z("H2", 11),
195
+ h3: Z("H3", 11),
196
+ bulletList: X("<line x1=\"8\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"8\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"8\" y1=\"18\" x2=\"21\" y2=\"18\"/><circle cx=\"3.5\" cy=\"6\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"3.5\" cy=\"12\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"3.5\" cy=\"18\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/>"),
197
+ orderedList: X("<line x1=\"10\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"10\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"10\" y1=\"18\" x2=\"21\" y2=\"18\"/><path d=\"M4 6h1v4\"/><path d=\"M4 10h2\"/><path d=\"M6 18H4c0-1 2-1.5 2-2.5S5 14 4 14.5\"/>"),
198
+ quote: X("<path d=\"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z\" fill=\"currentColor\" stroke=\"none\"/>"),
199
+ codeBlock: X("<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"m9 10-2 2 2 2\"/><path d=\"m15 10 2 2-2 2\"/>"),
200
+ hr: X("<line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\"/>"),
201
+ image: X("<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\"/>"),
202
+ spoiler: X("<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\"/>"),
203
+ latex: Z("Σ", 15),
204
+ smile: X("<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\"/>")
205
+ }, $ = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), Ee = [
201
206
  "title",
202
207
  "aria-label",
203
208
  "aria-expanded"
204
- ], Oe = ["innerHTML"], ke = { class: "kun-editor__picker-panel" }, Ae = {
209
+ ], De = ["innerHTML"], Oe = { class: "kun-editor__picker-panel" }, ke = {
205
210
  key: 0,
206
211
  class: "kun-editor__picker-tabs",
207
212
  role: "tablist"
208
- }, je = ["data-active"], Me = ["data-active"], Ne = { class: "kun-editor__emoji-grid" }, Pe = ["onClick"], Fe = {
213
+ }, Ae = ["data-active"], je = ["data-active"], Me = { class: "kun-editor__emoji-grid" }, Ne = ["onClick"], Pe = {
209
214
  key: 1,
210
215
  class: "kun-editor__sticker-body"
211
- }, Ie = { class: "kun-editor__pack-name" }, Le = { class: "kun-editor__sticker-grid" }, Re = ["title", "onClick"], ze = ["src", "alt"], Be = {
216
+ }, Fe = { class: "kun-editor__pack-name" }, Ie = { class: "kun-editor__sticker-grid" }, Le = ["title", "onClick"], Re = ["src", "alt"], ze = {
212
217
  key: 1,
213
218
  class: "kun-editor__picker-hint"
214
- }, Ve = /* @__PURE__ */ s({
219
+ }, Be = /* @__PURE__ */ s({
215
220
  __name: "StickerPicker",
216
221
  setup(n) {
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 ? {
222
+ let [, o] = k(), s = l(Y), c = s?.adapters.stickerSource, u = !!c, d = t(() => (s?.locale ?? "zh-cn").toLowerCase().startsWith("en")), h = t(() => d.value ? {
218
223
  trigger: "Emoji & stickers",
219
224
  emoji: "Emoji",
220
225
  sticker: "Stickers",
@@ -226,7 +231,7 @@ var q = Symbol("kun-editor-context"), ve = [
226
231
  sticker: "贴纸",
227
232
  empty: "暂无贴纸",
228
233
  failed: "贴纸加载失败"
229
- }), x = h(!1), S = h(null), w = h("emoji"), T = h([]), E = h(!1), D = h(!1), k = async () => {
234
+ }), v = g(!1), S = g(null), C = g("emoji"), T = g([]), E = g(!1), D = g(!1), O = async () => {
230
235
  if (!(E.value || !c)) {
231
236
  E.value = !0;
232
237
  try {
@@ -236,59 +241,59 @@ var q = Symbol("kun-editor-context"), ve = [
236
241
  }
237
242
  }
238
243
  }, A = () => {
239
- x.value = !x.value, x.value && u && k();
244
+ v.value = !v.value, v.value && u && O();
240
245
  }, j = (e) => {
241
- x.value && S.value && !S.value.contains(e.target) && (x.value = !1);
246
+ v.value && S.value && !S.value.contains(e.target) && (v.value = !1);
242
247
  };
243
- f(() => document.addEventListener("click", j)), d(() => document.removeEventListener("click", j));
248
+ p(() => document.addEventListener("click", j)), f(() => document.removeEventListener("click", j));
244
249
  let M = (e) => {
245
250
  o()?.action((t) => {
246
- let n = t.get(P), { state: r } = n;
251
+ let n = t.get(F), { state: r } = n;
247
252
  n.dispatch(r.tr.insertText(e, r.selection.from));
248
253
  });
249
254
  }, N = (e, t) => {
250
- o()?.action(R(W.key, {
255
+ o()?.action(V(oe.key, {
251
256
  src: e,
252
257
  title: t,
253
258
  alt: t
254
259
  }));
255
260
  };
256
- return (t, n) => (p(), i("div", {
261
+ return (t, n) => (m(), i("div", {
257
262
  ref_key: "rootRef",
258
263
  ref: S,
259
264
  class: "kun-editor__picker"
260
265
  }, [a("button", {
261
266
  type: "button",
262
267
  class: "kun-editor__tool",
263
- title: _.value.trigger,
264
- "aria-label": _.value.trigger,
265
- "aria-expanded": x.value,
268
+ title: h.value.trigger,
269
+ "aria-label": h.value.trigger,
270
+ "aria-expanded": v.value,
266
271
  onClick: A
267
272
  }, [a("span", {
268
273
  class: "kun-editor__icon",
269
- innerHTML: y(X).smile
270
- }, null, 8, Oe)], 8, De), C(a("div", ke, [
271
- u ? (p(), i("div", Ae, [a("button", {
274
+ innerHTML: b(Q).smile
275
+ }, null, 8, De)], 8, Ee), w(a("div", Oe, [
276
+ u ? (m(), i("div", ke, [a("button", {
272
277
  type: "button",
273
278
  class: "kun-editor__picker-tab",
274
- "data-active": w.value === "emoji",
275
- onClick: n[0] ||= (e) => w.value = "emoji"
276
- }, v(_.value.emoji), 9, je), a("button", {
279
+ "data-active": C.value === "emoji",
280
+ onClick: n[0] ||= (e) => C.value = "emoji"
281
+ }, y(h.value.emoji), 9, Ae), a("button", {
277
282
  type: "button",
278
283
  class: "kun-editor__picker-tab",
279
- "data-active": w.value === "sticker",
280
- onClick: n[1] ||= (e) => w.value = "sticker"
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", {
284
+ "data-active": C.value === "sticker",
285
+ onClick: n[1] ||= (e) => C.value = "sticker"
286
+ }, y(h.value.sticker), 9, je)])) : r("", !0),
287
+ w(a("div", Me, [(m(!0), i(e, null, _(b($), (e, t) => (m(), i("button", {
283
288
  key: t,
284
289
  type: "button",
285
290
  class: "kun-editor__emoji",
286
291
  onClick: (t) => M(e)
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", {
292
+ }, y(e), 9, Ne))), 128))], 512), [[x, !u || C.value === "emoji"]]),
293
+ u ? w((m(), i("div", Pe, [T.value.length ? (m(!0), i(e, { key: 0 }, _(T.value, (t) => (m(), i("div", {
289
294
  key: t.name,
290
295
  class: "kun-editor__pack"
291
- }, [a("div", Ie, v(t.name), 1), a("div", Le, [(p(!0), i(e, null, g(t.stickers, (e, t) => (p(), i("button", {
296
+ }, [a("div", Fe, y(t.name), 1), a("div", Ie, [(m(!0), i(e, null, _(t.stickers, (e, t) => (m(), i("button", {
292
297
  key: t,
293
298
  type: "button",
294
299
  class: "kun-editor__sticker",
@@ -298,26 +303,26 @@ var q = Symbol("kun-editor-context"), ve = [
298
303
  src: e.src,
299
304
  alt: e.name,
300
305
  loading: "lazy"
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)
302
- ], 512), [[b, x.value]])], 512));
306
+ }, null, 8, Re)], 8, Le))), 128))])]))), 128)) : (m(), i("div", ze, y(D.value ? h.value.failed : h.value.empty), 1))], 512)), [[x, C.value === "sticker"]]) : r("", !0)
307
+ ], 512), [[x, v.value]])], 512));
303
308
  }
304
- }), He = {
309
+ }), Ve = {
305
310
  class: "kun-editor__format-toolbar",
306
311
  role: "toolbar"
307
- }, Ue = ["aria-label"], We = {
312
+ }, He = ["aria-label"], Ue = {
308
313
  value: "",
309
314
  disabled: "",
310
315
  selected: ""
311
- }, Ge = ["value"], Ke = [
316
+ }, We = ["value"], Ge = [
312
317
  "title",
313
318
  "aria-label",
314
319
  "onClick"
315
- ], qe = ["innerHTML"], Je = ["title", "aria-label"], Ye = ["innerHTML"], Q = /* @__PURE__ */ s({
320
+ ], Ke = ["innerHTML"], qe = ["title", "aria-label"], Je = ["innerHTML"], Ye = /* @__PURE__ */ s({
316
321
  __name: "EditorToolbar",
317
322
  setup(n) {
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) => {
319
- s()?.action(R(e, t));
320
- }, _ = t(() => {
323
+ let [, s] = k(), c = l(Y), u = t(() => c?.adapters.uploadImage), d = t(() => c?.features.sticker !== !1), f = t(() => (c?.locale ?? "zh-cn").toLowerCase().startsWith("en")), p = (e, t) => {
324
+ s()?.action(V(e, t));
325
+ }, h = t(() => {
321
326
  let e = f.value;
322
327
  return {
323
328
  textSize: e ? "Text size" : "文本大小",
@@ -333,7 +338,7 @@ var q = Symbol("kun-editor-context"), ve = [
333
338
  spoiler: e ? "Spoiler" : "隐藏文本",
334
339
  image: e ? "Upload image" : "上传图片"
335
340
  };
336
- }), b = t(() => {
341
+ }), v = t(() => {
337
342
  let e = f.value;
338
343
  return [
339
344
  "正文",
@@ -349,87 +354,87 @@ var q = Symbol("kun-editor-context"), ve = [
349
354
  }));
350
355
  }), x = (e) => {
351
356
  let t = e.target;
352
- m(se.key, Number(t.value)), t.selectedIndex = 0;
357
+ p(ne.key, Number(t.value)), t.selectedIndex = 0;
353
358
  }, S = t(() => [
354
359
  [
355
360
  {
356
- svg: X.bold,
357
- title: _.value.bold,
358
- run: () => m(ue.key)
361
+ svg: Q.bold,
362
+ title: h.value.bold,
363
+ run: () => p(le.key)
359
364
  },
360
365
  {
361
- svg: X.italic,
362
- title: _.value.italic,
363
- run: () => m(G.key)
366
+ svg: Q.italic,
367
+ title: h.value.italic,
368
+ run: () => p(se.key)
364
369
  },
365
370
  {
366
- svg: X.strike,
367
- title: _.value.strike,
368
- run: () => m(me.key)
371
+ svg: Q.strike,
372
+ title: h.value.strike,
373
+ run: () => p(pe.key)
369
374
  },
370
375
  {
371
- svg: X.code,
372
- title: _.value.code,
373
- run: () => m(le.key)
376
+ svg: Q.code,
377
+ title: h.value.code,
378
+ run: () => p(ce.key)
374
379
  }
375
380
  ],
376
381
  [
377
382
  {
378
- svg: X.bulletList,
379
- title: _.value.bulletList,
380
- run: () => m(fe.key)
383
+ svg: Q.bulletList,
384
+ title: h.value.bulletList,
385
+ run: () => p(de.key)
381
386
  },
382
387
  {
383
- svg: X.orderedList,
384
- title: _.value.orderedList,
385
- run: () => m(pe.key)
388
+ svg: Q.orderedList,
389
+ title: h.value.orderedList,
390
+ run: () => p(fe.key)
386
391
  },
387
392
  {
388
- svg: X.quote,
389
- title: _.value.quote,
390
- run: () => m(de.key)
393
+ svg: Q.quote,
394
+ title: h.value.quote,
395
+ run: () => p(ue.key)
391
396
  },
392
397
  {
393
- svg: X.codeBlock,
394
- title: _.value.codeBlock,
395
- run: () => m(H.key, "")
398
+ svg: Q.codeBlock,
399
+ title: h.value.codeBlock,
400
+ run: () => p(ie.key, "")
396
401
  },
397
402
  {
398
- svg: X.hr,
399
- title: _.value.hr,
400
- run: () => m(U.key)
403
+ svg: Q.hr,
404
+ title: h.value.hr,
405
+ run: () => p(ae.key)
401
406
  }
402
407
  ],
403
408
  [{
404
- svg: X.spoiler,
405
- title: _.value.spoiler,
406
- run: () => m(ie.key)
409
+ svg: Q.spoiler,
410
+ title: h.value.spoiler,
411
+ run: () => p(W.key)
407
412
  }]
408
- ]), C = h(null), w = () => C.value?.click(), T = (e) => {
413
+ ]), C = g(null), w = () => C.value?.click(), T = (e) => {
409
414
  let t = e.target, n = t.files?.[0];
410
415
  t.value = "";
411
416
  let r = u.value;
412
417
  !n || !r || s()?.action((e) => {
413
- V(e.get(P), n, {
418
+ q(e.get(F), n, {
414
419
  uploadImage: r,
415
420
  notify: c?.adapters.notify,
416
421
  locale: c?.locale
417
422
  });
418
423
  });
419
424
  };
420
- return (t, n) => (p(), i("div", He, [
425
+ return (t, n) => (m(), i("div", Ve, [
421
426
  a("select", {
422
427
  class: "kun-editor__heading-select",
423
- "aria-label": _.value.textSize,
428
+ "aria-label": h.value.textSize,
424
429
  onChange: x
425
- }, [a("option", We, v(_.value.textSize), 1), (p(!0), i(e, null, g(b.value, (e) => (p(), i("option", {
430
+ }, [a("option", Ue, y(h.value.textSize), 1), (m(!0), i(e, null, _(v.value, (e) => (m(), i("option", {
426
431
  key: e.level,
427
432
  value: e.level
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", {
433
+ }, y(e.label), 9, We))), 128))], 40, He),
434
+ (m(!0), i(e, null, _(S.value, (t, r) => (m(), i(e, { key: r }, [n[0] ||= a("span", {
430
435
  class: "kun-editor__toolbar-divider",
431
436
  "aria-hidden": "true"
432
- }, null, -1), (p(!0), i(e, null, g(t, (e, t) => (p(), i("button", {
437
+ }, null, -1), (m(!0), i(e, null, _(t, (e, t) => (m(), i("button", {
433
438
  key: t,
434
439
  type: "button",
435
440
  class: "kun-editor__tool",
@@ -439,8 +444,8 @@ var q = Symbol("kun-editor-context"), ve = [
439
444
  }, [a("span", {
440
445
  class: "kun-editor__icon",
441
446
  innerHTML: e.svg
442
- }, null, 8, qe)], 8, Ke))), 128))], 64))), 128)),
443
- u.value ? (p(), i(e, { key: 0 }, [
447
+ }, null, 8, Ke)], 8, Ge))), 128))], 64))), 128)),
448
+ u.value ? (m(), i(e, { key: 0 }, [
444
449
  n[1] ||= a("span", {
445
450
  class: "kun-editor__toolbar-divider",
446
451
  "aria-hidden": "true"
@@ -448,13 +453,13 @@ var q = Symbol("kun-editor-context"), ve = [
448
453
  a("button", {
449
454
  type: "button",
450
455
  class: "kun-editor__tool",
451
- title: _.value.image,
452
- "aria-label": _.value.image,
456
+ title: h.value.image,
457
+ "aria-label": h.value.image,
453
458
  onClick: w
454
459
  }, [a("span", {
455
460
  class: "kun-editor__icon",
456
- innerHTML: y(X).image
457
- }, null, 8, Ye)], 8, Je),
461
+ innerHTML: b(Q).image
462
+ }, null, 8, Je)], 8, qe),
458
463
  a("input", {
459
464
  ref_key: "fileInput",
460
465
  ref: C,
@@ -464,31 +469,31 @@ var q = Symbol("kun-editor-context"), ve = [
464
469
  onChange: T
465
470
  }, null, 544)
466
471
  ], 64)) : r("", !0),
467
- d.value ? (p(), i(e, { key: 1 }, [n[2] ||= a("span", {
472
+ d.value ? (m(), i(e, { key: 1 }, [n[2] ||= a("span", {
468
473
  class: "kun-editor__toolbar-divider",
469
474
  "aria-hidden": "true"
470
- }, null, -1), o(Ve)], 64)) : r("", !0)
475
+ }, null, -1), o(Be)], 64)) : r("", !0)
471
476
  ]));
472
477
  }
473
478
  }), Xe = /* @__PURE__ */ s({
474
479
  __name: "ToolbarHost",
475
480
  setup(e) {
476
- let [, t] = O(), n = l(q, void 0), r = (e, n) => {
477
- t()?.action(R(e, n));
481
+ let [, t] = k(), n = l(Y, void 0), r = (e, n) => {
482
+ t()?.action(V(e, n));
478
483
  }, i = () => {
479
- t()?.action((e) => e.get(P).focus());
484
+ t()?.action((e) => e.get(F).focus());
480
485
  }, a = {
481
486
  run: r,
482
487
  insertText: (e) => {
483
488
  t()?.action((t) => {
484
- let n = t.get(P);
489
+ let n = t.get(F);
485
490
  n.dispatch(n.state.tr.insertText(e));
486
491
  }), i();
487
492
  },
488
493
  uploadImage: (e) => {
489
494
  let r = n?.adapters.uploadImage, i = t();
490
495
  !r || !i || i.action((t) => {
491
- V(t.get(P), e, {
496
+ q(t.get(F), e, {
492
497
  uploadImage: r,
493
498
  notify: n?.adapters.notify,
494
499
  locale: n?.locale
@@ -496,10 +501,10 @@ var q = Symbol("kun-editor-context"), ve = [
496
501
  });
497
502
  },
498
503
  insertQuote: (e) => {
499
- r(B.key, e), i();
504
+ r(K.key, e), i();
500
505
  },
501
506
  insertMention: (e) => {
502
- r(z.key, e), i();
507
+ r(G.key, e), i();
503
508
  },
504
509
  focus: i,
505
510
  get adapters() {
@@ -512,7 +517,7 @@ var q = Symbol("kun-editor-context"), ve = [
512
517
  return n?.locale ?? "zh-cn";
513
518
  }
514
519
  };
515
- return (e, t) => _(e.$slots, "default", u(c(a)));
520
+ return (e, t) => v(e.$slots, "default", d(c(a)));
516
521
  }
517
522
  }), Ze = /* @__PURE__ */ s({
518
523
  __name: "MarkdownSource",
@@ -522,41 +527,42 @@ var q = Symbol("kun-editor-context"), ve = [
522
527
  },
523
528
  emits: ["update:modelValue"],
524
529
  setup(e, { emit: t }) {
525
- let n = e, r = t, a = h(null), o = null, s = (e) => he.create({
530
+ let n = e, r = t, a = g(null), o = null, s = (e) => me.create({
526
531
  doc: e,
527
532
  extensions: [
528
- ae(),
529
- K.lineWrapping,
530
- _e,
531
- ge(),
532
- K.editable.of(!n.readonly),
533
- K.updateListener.of((e) => {
533
+ ee(),
534
+ J.lineWrapping,
535
+ ge,
536
+ he(),
537
+ J.editable.of(!n.readonly),
538
+ J.updateListener.of((e) => {
534
539
  e.docChanged && r("update:modelValue", e.state.doc.toString());
535
540
  })
536
541
  ]
537
542
  });
538
- return f(() => {
539
- a.value && (o = new K({
543
+ return p(() => {
544
+ a.value && (o = new J({
540
545
  state: s(n.modelValue),
541
546
  parent: a.value
542
547
  }));
543
- }), d(() => {
548
+ }), f(() => {
544
549
  o?.destroy(), o = null;
545
- }), x(() => n.modelValue, (e) => {
550
+ }), S(() => n.modelValue, (e) => {
546
551
  o && o.state.doc.toString() !== e && o.setState(s(e));
547
- }), (e, t) => (p(), i("div", {
552
+ }), (e, t) => (m(), i("div", {
548
553
  ref_key: "host",
549
554
  ref: a,
550
555
  class: "kun-editor__source"
551
556
  }, null, 512));
552
557
  }
553
- }), Qe = {
554
- class: "kun-editor",
555
- "data-kun-editor": ""
556
- }, $e = {
558
+ }), Qe = ["data-mode"], $e = {
557
559
  class: "kun-editor__toolbar",
558
560
  role: "tablist"
559
- }, et = ["aria-selected", "data-active"], tt = ["aria-selected", "data-active"], nt = { class: "kun-editor__wysiwyg" }, $ = /* @__PURE__ */ s({
561
+ }, et = ["aria-selected", "data-active"], tt = ["aria-selected", "data-active"], nt = ["aria-selected", "data-active"], rt = ["title", "aria-label"], it = [
562
+ "data-active",
563
+ "title",
564
+ "aria-pressed"
565
+ ], at = ["data-swap"], ot = { class: "kun-editor__wysiwyg kun-editor__pane" }, st = /* @__PURE__ */ s({
560
566
  __name: "KunEditor",
561
567
  props: {
562
568
  modelValue: {},
@@ -567,90 +573,165 @@ var q = Symbol("kun-editor-context"), ve = [
567
573
  type: Boolean,
568
574
  default: !1
569
575
  },
570
- placeholder: { default: "" }
576
+ placeholder: { default: "" },
577
+ scrollSync: {
578
+ type: Boolean,
579
+ default: !0
580
+ }
571
581
  },
572
582
  emits: ["update:modelValue"],
573
- setup(e, { expose: s, emit: l }) {
574
- let d = e, f = l;
575
- m(q, {
583
+ setup(s, { expose: l, emit: p }) {
584
+ let _ = s, T = p;
585
+ h(Y, {
576
586
  get adapters() {
577
- return d.adapters;
587
+ return _.adapters;
578
588
  },
579
589
  get features() {
580
- return d.features;
590
+ return _.features;
581
591
  },
582
592
  get locale() {
583
- return d.locale;
593
+ return _.locale;
584
594
  }
585
595
  });
586
- let g = h("wysiwyg"), x = (e) => {
587
- g.value = e;
588
- }, w = t(() => d.locale.toLowerCase().startsWith("en")), T = t(() => w.value ? {
596
+ let E = g("wysiwyg"), O = (e) => {
597
+ E.value = e;
598
+ }, k = g(!1), j = () => {
599
+ k.value = !k.value;
600
+ }, M = g(_.scrollSync);
601
+ S(() => _.scrollSync, (e) => {
602
+ M.value = e;
603
+ });
604
+ let N = () => {
605
+ M.value = !M.value;
606
+ }, P = t(() => _.locale.toLowerCase().startsWith("en")), F = t(() => P.value ? {
589
607
  wysiwyg: "Preview",
590
- source: "Markdown"
608
+ source: "Markdown",
609
+ split: "Split",
610
+ swap: "Swap sides",
611
+ scrollSync: "Sync scroll"
591
612
  } : {
592
613
  wysiwyg: "预览",
593
- source: "Markdown"
594
- }), D = (e) => f("update:modelValue", e), O = h(null);
595
- return s({
596
- insertQuote: (e) => O.value?.insertQuote(e),
597
- insertMention: (e) => O.value?.insertMention(e),
598
- focus: () => O.value?.focus()
599
- }), (t, s) => (p(), i("div", Qe, [
600
- _(t.$slots, "view-switch", {
601
- mode: g.value,
602
- setMode: x,
603
- labels: T.value
604
- }, () => [a("div", $e, [a("button", {
614
+ source: "Markdown",
615
+ split: "分栏",
616
+ swap: "左右互换",
617
+ scrollSync: "同步滚动"
618
+ }), I = g(null), L = null, R = null, z = null, B = () => {
619
+ L?.(), L = null, R = null;
620
+ }, V = () => {
621
+ B();
622
+ let e = I.value;
623
+ if (!e) return;
624
+ let t = e.querySelector(".cm-scroller"), n = e.querySelector(".kun-editor__wysiwyg");
625
+ if (!t || !n) return;
626
+ let r = (e, t) => () => {
627
+ if (R && R !== e) return;
628
+ R = e;
629
+ let n = e.scrollHeight - e.clientHeight, r = n > 0 ? e.scrollTop / n : 0, i = t.scrollHeight - t.clientHeight;
630
+ t.scrollTop = r * (i > 0 ? i : 0), z && clearTimeout(z), z = setTimeout(() => {
631
+ R = null;
632
+ }, 120);
633
+ }, i = r(t, n), a = r(n, t);
634
+ t.addEventListener("scroll", i, { passive: !0 }), n.addEventListener("scroll", a, { passive: !0 }), L = () => {
635
+ t.removeEventListener("scroll", i), n.removeEventListener("scroll", a);
636
+ };
637
+ };
638
+ S([E, M], ([e, t]) => {
639
+ B(), e === "split" && t && u(V);
640
+ }), f(B);
641
+ let H = t(() => _.readonly || E.value === "split"), U = (e) => T("update:modelValue", e), W = g(null);
642
+ return l({
643
+ insertQuote: (e) => W.value?.insertQuote(e),
644
+ insertMention: (e) => W.value?.insertMention(e),
645
+ focus: () => W.value?.focus()
646
+ }), (t, l) => (m(), i("div", {
647
+ ref_key: "rootEl",
648
+ ref: I,
649
+ class: "kun-editor",
650
+ "data-kun-editor": "",
651
+ "data-mode": E.value
652
+ }, [v(t.$slots, "view-switch", {
653
+ mode: E.value,
654
+ setMode: O,
655
+ labels: F.value,
656
+ swapped: k.value,
657
+ swap: j,
658
+ scrollSync: M.value,
659
+ toggleScrollSync: N
660
+ }, () => [a("div", $e, [
661
+ a("button", {
662
+ type: "button",
663
+ class: "kun-editor__tab",
664
+ "aria-selected": E.value === "wysiwyg",
665
+ "data-active": E.value === "wysiwyg",
666
+ onClick: l[0] ||= (e) => O("wysiwyg")
667
+ }, y(F.value.wysiwyg), 9, et),
668
+ a("button", {
605
669
  type: "button",
606
670
  class: "kun-editor__tab",
607
- "aria-selected": g.value === "wysiwyg",
608
- "data-active": g.value === "wysiwyg",
609
- onClick: s[0] ||= (e) => x("wysiwyg")
610
- }, v(T.value.wysiwyg), 9, et), a("button", {
671
+ "aria-selected": E.value === "source",
672
+ "data-active": E.value === "source",
673
+ onClick: l[1] ||= (e) => O("source")
674
+ }, y(F.value.source), 9, tt),
675
+ a("button", {
611
676
  type: "button",
612
677
  class: "kun-editor__tab",
613
- "aria-selected": g.value === "source",
614
- "data-active": g.value === "source",
615
- onClick: s[1] ||= (e) => x("source")
616
- }, v(T.value.source), 9, tt)])]),
617
- o(y(E), null, {
618
- default: S(() => [o(y(k), null, {
619
- default: S(() => [C(a("div", null, [o(Xe, null, {
620
- default: S((e) => [_(t.$slots, "toolbar", u(c(e)), () => [o(Q)])]),
621
- _: 3
622
- })], 512), [[b, g.value === "wysiwyg" && !e.readonly]]), C(a("div", nt, [o(Ee, {
623
- ref_key: "inner",
624
- ref: O,
625
- "model-value": e.modelValue,
626
- adapters: e.adapters,
627
- features: e.features,
628
- locale: e.locale,
629
- readonly: e.readonly,
630
- placeholder: e.placeholder,
631
- "onUpdate:modelValue": D
632
- }, null, 8, [
633
- "model-value",
634
- "adapters",
635
- "features",
636
- "locale",
637
- "readonly",
638
- "placeholder"
639
- ])], 512), [[b, g.value === "wysiwyg"]])]),
678
+ "aria-selected": E.value === "split",
679
+ "data-active": E.value === "split",
680
+ onClick: l[2] ||= (e) => O("split")
681
+ }, y(F.value.split), 9, nt),
682
+ E.value === "split" ? (m(), i(e, { key: 0 }, [a("button", {
683
+ type: "button",
684
+ class: "kun-editor__tab kun-editor__swap",
685
+ title: F.value.swap,
686
+ "aria-label": F.value.swap,
687
+ onClick: l[3] ||= (e) => j()
688
+ }, "", 8, rt), a("button", {
689
+ type: "button",
690
+ class: "kun-editor__tab",
691
+ "data-active": M.value,
692
+ title: F.value.scrollSync,
693
+ "aria-pressed": M.value,
694
+ onClick: l[4] ||= (e) => N()
695
+ }, y(F.value.scrollSync), 9, it)], 64)) : r("", !0)
696
+ ])]), o(b(D), null, {
697
+ default: C(() => [o(b(A), null, {
698
+ default: C(() => [w(a("div", null, [o(Xe, null, {
699
+ default: C((e) => [v(t.$slots, "toolbar", d(c(e)), () => [o(Ye)])]),
640
700
  _: 3
641
- })]),
701
+ })], 512), [[x, E.value === "wysiwyg" && !s.readonly]]), a("div", {
702
+ class: "kun-editor__panes",
703
+ "data-swap": k.value
704
+ }, [E.value === "source" || E.value === "split" ? (m(), n(Ze, {
705
+ key: 0,
706
+ class: "kun-editor__pane",
707
+ "model-value": s.modelValue,
708
+ readonly: s.readonly,
709
+ "onUpdate:modelValue": U
710
+ }, null, 8, ["model-value", "readonly"])) : r("", !0), w(a("div", ot, [o(Te, {
711
+ ref_key: "inner",
712
+ ref: W,
713
+ "model-value": s.modelValue,
714
+ adapters: s.adapters,
715
+ features: s.features,
716
+ locale: s.locale,
717
+ readonly: H.value,
718
+ placeholder: s.placeholder,
719
+ "onUpdate:modelValue": U
720
+ }, null, 8, [
721
+ "model-value",
722
+ "adapters",
723
+ "features",
724
+ "locale",
725
+ "readonly",
726
+ "placeholder"
727
+ ])], 512), [[x, E.value === "wysiwyg" || E.value === "split"]])], 8, at)]),
642
728
  _: 3
643
- }),
644
- g.value === "source" ? (p(), n(Ze, {
645
- key: 0,
646
- "model-value": e.modelValue,
647
- readonly: e.readonly,
648
- "onUpdate:modelValue": D
649
- }, null, 8, ["model-value", "readonly"])) : r("", !0)
650
- ]));
729
+ })]),
730
+ _: 3
731
+ })], 8, Qe));
651
732
  }
652
- }), rt = { install(e) {
653
- e.component("KunEditor", $);
733
+ }), ct = { install(e) {
734
+ e.component("KunEditor", st);
654
735
  } };
655
736
  //#endregion
656
- export { Z as EMOJI, $ as KunEditor, rt as KunEditorPlugin };
737
+ export { $ as EMOJI, st as KunEditor, ct as KunEditorPlugin };
package/dist/types.d.ts CHANGED
@@ -31,15 +31,26 @@ export interface KunEditorToolbarApi {
31
31
  readonly locale: KunEditorLocale;
32
32
  }
33
33
  export interface KunEditorViewSwitchApi {
34
- /** The active view. */
35
- mode: 'wysiwyg' | 'source';
34
+ /** The active view: WYSIWYG, markdown source, or the desktop split. */
35
+ mode: 'wysiwyg' | 'source' | 'split';
36
36
  /** Switch the active view. */
37
- setMode: (mode: 'wysiwyg' | 'source') => void;
38
- /** Localized labels for the two views (respects the `locale` prop). */
37
+ setMode: (mode: 'wysiwyg' | 'source' | 'split') => void;
38
+ /** Localized labels (respects the `locale` prop). */
39
39
  labels: {
40
40
  wysiwyg: string;
41
41
  source: string;
42
+ split: string;
43
+ swap: string;
44
+ scrollSync: string;
42
45
  };
46
+ /** Whether the split panes are swapped (source on the right). */
47
+ swapped: boolean;
48
+ /** Toggle the split panes' left/right order. */
49
+ swap: () => void;
50
+ /** Whether split-pane scroll sync is on. */
51
+ scrollSync: boolean;
52
+ /** Toggle split-pane scroll sync. */
53
+ toggleScrollSync: () => void;
43
54
  }
44
55
  export interface KunEditorExpose {
45
56
  /**
@@ -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;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACjC,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,IAAI,CAAA;IAClE,gCAAgC;IAChC,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CACjC;AAMD,MAAM,WAAW,sBAAsB;IACrC,uBAAuB;IACvB,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC1B,8BAA8B;IAC9B,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,KAAK,IAAI,CAAA;IAC7C,uEAAuE;IACvE,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5C;AASD,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC5D;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC9D,gCAAgC;IAChC,KAAK,IAAI,IAAI,CAAA;CACd"}
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;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACjC,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,IAAI,CAAA;IAClE,gCAAgC;IAChC,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CACjC;AAMD,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;IACpC,8BAA8B;IAC9B,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,KAAK,IAAI,CAAA;IACvD,qDAAqD;IACrD,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAA;IAChB,gDAAgD;IAChD,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAAA;IACnB,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,IAAI,CAAA;CAC7B;AASD,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC5D;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;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.18.0",
3
+ "version": "0.20.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.18.0"
43
+ "@kungal/editor-core": "0.20.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.18.0"
83
+ "@kungal/editor-core": "0.20.0"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "vite build && vue-tsc -p tsconfig.build.json",