@kungal/editor-vue 0.26.0 → 0.27.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,36 @@
1
1
  # @kungal/editor-vue
2
2
 
3
+ ## 0.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ac86c0a: Add a heading-outline API for building a table of contents (TOC).
8
+
9
+ A host (e.g. a desktop editor with a left-side outline) can now render its own TOC
10
+ and navigate the editor, without reaching into editor internals:
11
+
12
+ - **`@update:headings`** on `<KunEditor>` — emits the ordered outline
13
+ (`KunHeading[]` = `{ level, text }`) whenever the content changes.
14
+ - **`ref.scrollToHeading(index)`** — scrolls to that heading in the _current_ view
15
+ and places the caret there: the WYSIWYG heading in wysiwyg mode, the CodeMirror
16
+ heading line in source/split mode (so a click navigates the editable pane).
17
+ - **editor-core** exports the pure `parseHeadings(markdown)` (and `KunHeading`) it's
18
+ built on — usable server-side too. Parses ATX headings, skipping code fences.
19
+
20
+ The TOC's styling, colour, indentation and layout (e.g. reserving space on the
21
+ left of the split editor) are entirely the host's — the editor only exposes the
22
+ data + navigation, matching the headless design.
23
+
24
+ Verified in a new docs example (`/examples/toc`): the outline tracks the content;
25
+ clicking an item scrolls + carets to that heading in wysiwyg (scrollTop 0→386,
26
+ caret in the target) and in source (CodeMirror scrolled, cursor on `## …`); new
27
+ `parseHeadings` unit tests pass; 0 console errors.
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [ac86c0a]
32
+ - @kungal/editor-core@0.27.0
33
+
3
34
  ## 0.26.0
4
35
 
5
36
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale } from '@kungal/editor-core';
1
+ import type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale, KunHeading } from '@kungal/editor-core';
2
2
  import type { KunEditorExpose, KunSelectionItem } from '../types';
3
3
  type ViewMode = 'wysiwyg' | 'source' | 'split';
4
4
  type __VLS_Props = {
@@ -80,8 +80,10 @@ type __VLS_Slots = {} & {
80
80
  };
81
81
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, KunEditorExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
82
82
  "update:modelValue": (markdown: string) => any;
83
+ "update:headings": (headings: KunHeading[]) => any;
83
84
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
84
85
  "onUpdate:modelValue"?: ((markdown: string) => any) | undefined;
86
+ "onUpdate:headings"?: ((headings: KunHeading[]) => any) | undefined;
85
87
  }>, {
86
88
  adapters: KunEditorAdapters;
87
89
  features: KunEditorFeatures;
@@ -1 +1 @@
1
- {"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AAwWA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAUjE,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE9C,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,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,KAAK,GAAG,OAAO,CAAA;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAA;IAClB;oEACgE;IAChE,UAA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,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -2,7 +2,9 @@ type __VLS_Props = {
2
2
  modelValue: string;
3
3
  readonly: boolean;
4
4
  };
5
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
6
+ scrollToHeading: (index: number) => void;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
8
  "update:modelValue": (markdown: string) => any;
7
9
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
8
10
  "onUpdate:modelValue"?: ((markdown: string) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownSource.vue.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownSource.vue"],"names":[],"mappings":"AA2GA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAC;AA2FF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"MarkdownSource.vue.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownSource.vue"],"names":[],"mappings":"AAkJA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAC;AAmIF,QAAA,MAAM,YAAY;6BA/Ec,MAAM;;;;;kFAmFpC,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"m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package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export type { KunToolbarItem } from './types';
7
7
  export type { KunSelectionItem } from './types';
8
8
  export type { KunEditorViewSwitchApi } from './types';
9
9
  export { EMOJI } from './emoji';
10
+ export type { KunHeading } from '@kungal/editor-core';
11
+ export { parseHeadings } from '@kungal/editor-core';
10
12
  export type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale, UploadImage, SearchMentionUsers, StickerSource, Notify, NotifyLevel, MentionUser, StickerItem, StickerPack } from '@kungal/editor-core';
11
13
  /** Vue plugin: `app.use(KunEditorPlugin)` to register <KunEditor> globally. */
12
14
  export declare const KunEditorPlugin: Plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,SAAS,MAAM,4BAA4B,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,CAAA;AAGpB,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAGlD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,+EAA+E;AAC/E,eAAO,MAAM,eAAe,EAAE,MAI7B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,SAAS,MAAM,4BAA4B,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,CAAA;AAGpB,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAGlD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,+EAA+E;AAC/E,eAAO,MAAM,eAAe,EAAE,MAI7B,CAAA"}
package/dist/index.js CHANGED
@@ -1,37 +1,38 @@
1
1
  import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, 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
2
  import { Milkdown as E, MilkdownProvider as D, useEditor as O, useInstance as k } from "@milkdown/vue";
3
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 { TooltipProvider as V, tooltipFactory as H } from "@milkdown/kit/plugin/tooltip";
8
- import { callCommand as U, replaceAll as ee } from "@milkdown/kit/utils";
9
- import { createKunEditorPlugins as te, insertKunSpoilerCommand as W, insertLinkCommand as G, insertMentionCommand as ne, insertQuoteCommand as re, kunCM as ie, mentionId as ae, setHeadingCommand as oe, startImageUpload as K } from "@kungal/editor-core/preset";
10
- import { TextSelection as se } from "@milkdown/kit/prose/state";
11
- import { createCodeBlockCommand as ce, insertHrCommand as le, insertImageCommand as ue, toggleEmphasisCommand as q, toggleInlineCodeCommand as de, toggleStrongCommand as fe, wrapInBlockquoteCommand as pe, wrapInBulletListCommand as me, wrapInOrderedListCommand as he } from "@milkdown/kit/preset/commonmark";
12
- import { toggleStrikethroughCommand as J } from "@milkdown/kit/preset/gfm";
13
- import { Annotation as ge, EditorState as _e } from "@codemirror/state";
4
+ import { parseHeadings as N, parseHeadings as ee } from "@kungal/editor-core";
5
+ import { Editor as P, defaultValueCtx as F, editorViewCtx as I, editorViewOptionsCtx as L, rootCtx as R } from "@milkdown/kit/core";
6
+ import { listenerCtx as z } from "@milkdown/kit/plugin/listener";
7
+ import { SlashProvider as B, slashFactory as V } from "@milkdown/kit/plugin/slash";
8
+ import { TooltipProvider as H, tooltipFactory as U } from "@milkdown/kit/plugin/tooltip";
9
+ import { callCommand as W, replaceAll as te } from "@milkdown/kit/utils";
10
+ import { TextSelection as G } from "@milkdown/kit/prose/state";
11
+ import { createKunEditorPlugins as K, insertKunSpoilerCommand as q, insertLinkCommand as J, insertMentionCommand as ne, insertQuoteCommand as re, kunCM as ie, mentionId as ae, setHeadingCommand as oe, startImageUpload as se } from "@kungal/editor-core/preset";
12
+ import { createCodeBlockCommand as ce, insertHrCommand as le, insertImageCommand as ue, toggleEmphasisCommand as de, toggleInlineCodeCommand as fe, toggleStrongCommand as pe, wrapInBlockquoteCommand as me, wrapInBulletListCommand as he, wrapInOrderedListCommand as ge } from "@milkdown/kit/preset/commonmark";
13
+ import { toggleStrikethroughCommand as _e } from "@milkdown/kit/preset/gfm";
14
+ import { Annotation as ve, EditorState as ye } from "@codemirror/state";
14
15
  import { EditorView as Y } from "@codemirror/view";
15
- import { markdown as ve } from "@codemirror/lang-markdown";
16
- import { basicSetup as ye } from "codemirror";
16
+ import { markdown as be } from "@codemirror/lang-markdown";
17
+ import { basicSetup as xe } from "codemirror";
17
18
  //#region src/context.ts
18
- var X = Symbol("kun-editor-context"), be = [
19
+ var X = Symbol("kun-editor-context"), Se = [
19
20
  "data-active",
20
21
  "onMousedown",
21
22
  "onMouseenter"
22
- ], xe = ["src", "alt"], Se = {
23
+ ], Ce = ["src", "alt"], we = {
23
24
  key: 1,
24
25
  class: "kun-mention-dropdown__avatar kun-mention-dropdown__avatar--fallback"
25
- }, Ce = { class: "kun-mention-dropdown__name" }, we = {
26
+ }, Te = { class: "kun-mention-dropdown__name" }, Ee = {
26
27
  key: 1,
27
28
  class: "kun-mention-dropdown__hint"
28
- }, Te = {
29
+ }, De = {
29
30
  key: 2,
30
31
  class: "kun-mention-dropdown__hint"
31
- }, Ee = {
32
+ }, Oe = {
32
33
  key: 3,
33
34
  class: "kun-mention-dropdown__hint"
34
- }, De = /* @__PURE__ */ s({
35
+ }, ke = /* @__PURE__ */ s({
35
36
  __name: "MentionDropdown",
36
37
  setup(n) {
37
38
  let r = /(?:^|\s)@([^\s@]{0,30})$/, o = l(X), s = o?.adapters.searchMentionUsers, c = t(() => (o?.locale ?? "zh-cn").toLowerCase().startsWith("en")), u = t(() => c.value ? {
@@ -58,20 +59,20 @@ var X = Symbol("kun-editor-context"), be = [
58
59
  }
59
60
  t === k && (w.value = n ?? [], E.value = 0, D.value = !1);
60
61
  }, 180);
61
- }, P = (e) => {
62
+ }, ee = (e) => {
62
63
  let { selection: t } = e.state;
63
64
  if (!t.empty) return null;
64
65
  let { $from: n } = t, i = n.parent.textBetween(Math.max(0, n.parentOffset - 100), n.parentOffset, void 0, "").match(r);
65
66
  return i ? i[1] ?? "" : null;
66
- }, F = (e) => {
67
- let t = P(e);
67
+ }, P = (e) => {
68
+ let t = ee(e);
68
69
  if (t === null) return !1;
69
70
  let n = e.state.selection.$from.pos;
70
71
  return O = {
71
72
  from: n - (t.length + 1),
72
73
  to: n
73
74
  }, t !== C.value && (C.value = t, N(t)), !0;
74
- }, I = (e) => {
75
+ }, F = (e) => {
75
76
  let t = d.value;
76
77
  if (!t || !O) return;
77
78
  let n = t.state.schema.nodes[ae];
@@ -80,8 +81,8 @@ var X = Symbol("kun-editor-context"), be = [
80
81
  userId: e.id,
81
82
  name: e.name
82
83
  }), { from: i, to: a } = O, o = t.state.tr.replaceWith(i, a, r), s = i + r.nodeSize;
83
- o.insertText(" ", s), o.setSelection(se.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
84
- }, L = (e) => {
84
+ o.insertText(" ", s), o.setSelection(G.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
85
+ }, I = (e) => {
85
86
  if (!x.value || !w.value.length) {
86
87
  x.value && e.key === "Escape" && (e.preventDefault(), b.hide());
87
88
  return;
@@ -97,7 +98,7 @@ var X = Symbol("kun-editor-context"), be = [
97
98
  case "Enter":
98
99
  case "Tab": {
99
100
  let t = w.value[E.value];
100
- t && (e.preventDefault(), e.stopPropagation(), I(t));
101
+ t && (e.preventDefault(), e.stopPropagation(), F(t));
101
102
  break;
102
103
  }
103
104
  case "Escape":
@@ -106,20 +107,20 @@ var X = Symbol("kun-editor-context"), be = [
106
107
  }
107
108
  };
108
109
  return p(() => {
109
- b = new z({
110
+ b = new B({
110
111
  content: v.value,
111
112
  trigger: "@",
112
- shouldShow: F,
113
+ shouldShow: P,
113
114
  debounce: 0
114
115
  }), b.onShow = () => {
115
116
  x.value = !0;
116
117
  }, b.onHide = () => {
117
118
  x.value = !1, M();
118
- }, b.update(d.value, h.value), window.addEventListener("keydown", L, !0);
119
+ }, b.update(d.value, h.value), window.addEventListener("keydown", I, !0);
119
120
  }), S([d, h], () => {
120
121
  b?.update(d.value, h.value);
121
122
  }), f(() => {
122
- A && clearTimeout(A), window.removeEventListener("keydown", L, !0), b?.destroy();
123
+ A && clearTimeout(A), window.removeEventListener("keydown", I, !0), b?.destroy();
123
124
  }), (t, n) => (m(), i("div", {
124
125
  ref_key: "divRef",
125
126
  ref: v,
@@ -130,14 +131,14 @@ var X = Symbol("kun-editor-context"), be = [
130
131
  type: "button",
131
132
  class: "kun-mention-dropdown__item",
132
133
  "data-active": t === E.value,
133
- onMousedown: T((t) => I(e), ["prevent"]),
134
+ onMousedown: T((t) => F(e), ["prevent"]),
134
135
  onMouseenter: (e) => E.value = t
135
136
  }, [e.avatar ? (m(), i("img", {
136
137
  key: 0,
137
138
  src: e.avatar,
138
139
  alt: e.name,
139
140
  class: "kun-mention-dropdown__avatar"
140
- }, null, 8, xe)) : (m(), i("span", Se, y(e.name.charAt(0)), 1)), a("span", Ce, y(e.name), 1)], 40, be))), 128)) : D.value ? (m(), i("div", we, y(u.value.searching), 1)) : C.value ? (m(), i("div", Te, y(u.value.empty), 1)) : (m(), i("div", Ee, y(u.value.prompt), 1))], 512));
141
+ }, null, 8, Ce)) : (m(), i("span", we, y(e.name.charAt(0)), 1)), a("span", Te, y(e.name), 1)], 40, Se))), 128)) : D.value ? (m(), i("div", Ee, y(u.value.searching), 1)) : C.value ? (m(), i("div", De, y(u.value.empty), 1)) : (m(), i("div", Oe, y(u.value.prompt), 1))], 512));
141
142
  }
142
143
  }), Z = (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>`, Q = (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>`, $ = {
143
144
  bold: Z("<path d=\"M6 4h8a4 4 0 0 1 0 8H6z\"/><path d=\"M6 12h9a4 4 0 0 1 0 8H6z\"/>"),
@@ -157,44 +158,44 @@ var X = Symbol("kun-editor-context"), be = [
157
158
  link: Z("<path d=\"M10 13a5 5 0 0 0 7.07 0l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.07 0l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>"),
158
159
  latex: Q("Σ", 15),
159
160
  smile: Z("<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\"/>")
160
- }, Oe = {
161
+ }, Ae = {
161
162
  key: 0,
162
163
  class: "kun-editor__toolbar-divider",
163
164
  "aria-hidden": "true"
164
- }, ke = [
165
+ }, je = [
165
166
  "title",
166
167
  "aria-label",
167
168
  "onMousedown"
168
- ], Ae = ["innerHTML"], je = /* @__PURE__ */ s({
169
+ ], Me = ["innerHTML"], Ne = /* @__PURE__ */ s({
169
170
  __name: "SelectionTooltip",
170
171
  setup(n) {
171
172
  let { view: r, prevState: o } = j(), [, s] = k(), c = l(X), u = t(() => (c?.locale ?? "zh-cn").toLowerCase().startsWith("en")), d = g(null), h, v = (e, t) => {
172
- s()?.action(U(e, t));
173
+ s()?.action(W(e, t));
173
174
  }, y = () => {
174
175
  let e = window.prompt(u.value ? "Link URL" : "链接 URL")?.trim();
175
- e && v(G.key, { href: e });
176
+ e && v(J.key, { href: e });
176
177
  }, b = t(() => {
177
178
  let e = u.value;
178
179
  return {
179
180
  bold: {
180
181
  svg: $.bold,
181
182
  title: e ? "Bold" : "加粗",
182
- run: () => v(fe.key)
183
+ run: () => v(pe.key)
183
184
  },
184
185
  italic: {
185
186
  svg: $.italic,
186
187
  title: e ? "Italic" : "斜体",
187
- run: () => v(q.key)
188
+ run: () => v(de.key)
188
189
  },
189
190
  strike: {
190
191
  svg: $.strike,
191
192
  title: e ? "Strikethrough" : "删除线",
192
- run: () => v(J.key)
193
+ run: () => v(_e.key)
193
194
  },
194
195
  code: {
195
196
  svg: $.code,
196
197
  title: e ? "Inline code" : "行内代码",
197
- run: () => v(de.key)
198
+ run: () => v(fe.key)
198
199
  },
199
200
  link: {
200
201
  svg: $.link,
@@ -218,7 +219,7 @@ var X = Symbol("kun-editor-context"), be = [
218
219
  return n;
219
220
  });
220
221
  return p(() => {
221
- h = new V({
222
+ h = new H({
222
223
  content: d.value,
223
224
  offset: 8
224
225
  }), h.update(r.value, o.value);
@@ -231,7 +232,7 @@ var X = Symbol("kun-editor-context"), be = [
231
232
  ref: d,
232
233
  class: "kun-editor__bubble",
233
234
  "data-show": "false"
234
- }, [(m(!0), i(e, null, _(x.value, (t, n) => (m(), i(e, { key: n }, [t.divider ? (m(), i("span", Oe)) : (m(), i("button", {
235
+ }, [(m(!0), i(e, null, _(x.value, (t, n) => (m(), i(e, { key: n }, [t.divider ? (m(), i("span", Ae)) : (m(), i("button", {
235
236
  key: 1,
236
237
  type: "button",
237
238
  class: "kun-editor__bubble-btn",
@@ -241,9 +242,9 @@ var X = Symbol("kun-editor-context"), be = [
241
242
  }, [a("span", {
242
243
  class: "kun-editor__icon",
243
244
  innerHTML: t.svg
244
- }, null, 8, Ae)], 40, ke))], 64))), 128))], 512));
245
+ }, null, 8, Me)], 40, je))], 64))), 128))], 512));
245
246
  }
246
- }), Me = /* @__PURE__ */ s({
247
+ }), Pe = /* @__PURE__ */ s({
247
248
  __name: "MilkdownEditor",
248
249
  props: {
249
250
  modelValue: {},
@@ -258,15 +259,15 @@ var X = Symbol("kun-editor-context"), be = [
258
259
  },
259
260
  emits: ["update:modelValue"],
260
261
  setup(e, { expose: t, emit: r }) {
261
- let i = e, a = r, o = i.modelValue, s = !1, c = M(), l = B("kunMention"), u = i.features.mention !== !1 && !!i.adapters.searchMentionUsers && !!c, d = H("kunSelectionTooltip"), f = i.selectionToolbar && !!c, p = O((e) => {
262
- let t = N.make().config((t) => {
263
- t.set(L, e), t.set(P, i.modelValue), t.get(R).markdownUpdated((e, t, n) => {
262
+ let i = e, a = r, o = i.modelValue, s = !1, c = M(), l = V("kunMention"), u = i.features.mention !== !1 && !!i.adapters.searchMentionUsers && !!c, d = U("kunSelectionTooltip"), f = i.selectionToolbar && !!c, p = O((e) => {
263
+ let t = P.make().config((t) => {
264
+ t.set(R, e), t.set(F, i.modelValue), t.get(z).markdownUpdated((e, t, n) => {
264
265
  !i.active || s || t === n || (o = t, a("update:modelValue", t));
265
- }), t.update(I, (e) => ({
266
+ }), t.update(L, (e) => ({
266
267
  ...e,
267
268
  editable: () => !i.readonly
268
- })), u && t.set(l.key, { view: c({ component: De }) }), f && t.set(d.key, { view: c({ component: je }) });
269
- }).use(te(i.adapters, i.features, {
269
+ })), u && t.set(l.key, { view: c({ component: ke }) }), f && t.set(d.key, { view: c({ component: Ne }) });
270
+ }).use(K(i.adapters, i.features, {
270
271
  locale: i.locale,
271
272
  placeholder: i.placeholder,
272
273
  placeholderMode: i.placeholderMode
@@ -277,41 +278,55 @@ var X = Symbol("kun-editor-context"), be = [
277
278
  if (e === o) return;
278
279
  o = e;
279
280
  let t = p.get();
280
- t && (s = !0, t.action(ee(e)), s = !1);
281
+ t && (s = !0, t.action(te(e)), s = !1);
281
282
  }), S(() => i.readonly, () => {
282
283
  p.get()?.action((e) => {
283
- let t = e.get(F);
284
+ let t = e.get(I);
284
285
  t.dispatch(t.state.tr);
285
286
  });
286
287
  });
287
288
  let h = () => {
288
- p.get()?.action((e) => e.get(F).focus());
289
+ p.get()?.action((e) => e.get(I).focus());
289
290
  };
290
291
  return t({
291
292
  insertQuote: (e) => {
292
- p.get()?.action(U(re.key, e)), h();
293
+ p.get()?.action(W(re.key, e)), h();
293
294
  },
294
295
  insertMention: (e) => {
295
- p.get()?.action(U(ne.key, e)), h();
296
+ p.get()?.action(W(ne.key, e)), h();
296
297
  },
297
- focus: h
298
+ focus: h,
299
+ scrollToHeading: (e) => {
300
+ p.get()?.action((t) => {
301
+ let n = t.get(I), r = 0, i = -1;
302
+ if (n.state.doc.forEach((t, n) => {
303
+ t.type.name === "heading" && (r === e && (i = n), r += 1);
304
+ }), !(i < 0) && (n.nodeDOM(i)?.scrollIntoView({
305
+ behavior: "smooth",
306
+ block: "start"
307
+ }), n.editable)) {
308
+ let e = G.near(n.state.doc.resolve(i + 1));
309
+ n.dispatch(n.state.tr.setSelection(e)), n.focus();
310
+ }
311
+ });
312
+ }
298
313
  }), (e, t) => (m(), n(b(E)));
299
314
  }
300
- }), Ne = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), Pe = [
315
+ }), Fe = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), Ie = [
301
316
  "title",
302
317
  "aria-label",
303
318
  "aria-expanded"
304
- ], Fe = ["innerHTML"], Ie = { class: "kun-editor__picker-panel" }, Le = {
319
+ ], Le = ["innerHTML"], Re = { class: "kun-editor__picker-panel" }, ze = {
305
320
  key: 0,
306
321
  class: "kun-editor__picker-tabs",
307
322
  role: "tablist"
308
- }, Re = ["data-active"], ze = ["data-active"], Be = { class: "kun-editor__emoji-grid" }, Ve = ["onClick"], He = {
323
+ }, Be = ["data-active"], Ve = ["data-active"], He = { class: "kun-editor__emoji-grid" }, Ue = ["onClick"], We = {
309
324
  key: 1,
310
325
  class: "kun-editor__sticker-body"
311
- }, Ue = { class: "kun-editor__pack-name" }, We = { class: "kun-editor__sticker-grid" }, Ge = ["title", "onClick"], Ke = ["src", "alt"], qe = {
326
+ }, Ge = { class: "kun-editor__pack-name" }, Ke = { class: "kun-editor__sticker-grid" }, qe = ["title", "onClick"], Je = ["src", "alt"], Ye = {
312
327
  key: 1,
313
328
  class: "kun-editor__picker-hint"
314
- }, Je = /* @__PURE__ */ s({
329
+ }, Xe = /* @__PURE__ */ s({
315
330
  __name: "StickerPicker",
316
331
  setup(n) {
317
332
  let [, o] = k(), s = l(X), c = s?.adapters.stickerSource, u = !!c, d = t(() => (s?.locale ?? "zh-cn").toLowerCase().startsWith("en")), h = t(() => d.value ? {
@@ -343,11 +358,11 @@ var X = Symbol("kun-editor-context"), be = [
343
358
  p(() => document.addEventListener("click", j)), f(() => document.removeEventListener("click", j));
344
359
  let M = (e) => {
345
360
  o()?.action((t) => {
346
- let n = t.get(F), { state: r } = n;
361
+ let n = t.get(I), { state: r } = n;
347
362
  n.dispatch(r.tr.insertText(e, r.selection.from));
348
363
  });
349
364
  }, N = (e, t) => {
350
- o()?.action(U(ue.key, {
365
+ o()?.action(W(ue.key, {
351
366
  src: e,
352
367
  title: t,
353
368
  alt: t
@@ -367,28 +382,28 @@ var X = Symbol("kun-editor-context"), be = [
367
382
  }, [a("span", {
368
383
  class: "kun-editor__icon",
369
384
  innerHTML: b($).smile
370
- }, null, 8, Fe)], 8, Pe), w(a("div", Ie, [
371
- u ? (m(), i("div", Le, [a("button", {
385
+ }, null, 8, Le)], 8, Ie), w(a("div", Re, [
386
+ u ? (m(), i("div", ze, [a("button", {
372
387
  type: "button",
373
388
  class: "kun-editor__picker-tab",
374
389
  "data-active": C.value === "emoji",
375
390
  onClick: n[0] ||= (e) => C.value = "emoji"
376
- }, y(h.value.emoji), 9, Re), a("button", {
391
+ }, y(h.value.emoji), 9, Be), a("button", {
377
392
  type: "button",
378
393
  class: "kun-editor__picker-tab",
379
394
  "data-active": C.value === "sticker",
380
395
  onClick: n[1] ||= (e) => C.value = "sticker"
381
- }, y(h.value.sticker), 9, ze)])) : r("", !0),
382
- w(a("div", Be, [(m(!0), i(e, null, _(b(Ne), (e, t) => (m(), i("button", {
396
+ }, y(h.value.sticker), 9, Ve)])) : r("", !0),
397
+ w(a("div", He, [(m(!0), i(e, null, _(b(Fe), (e, t) => (m(), i("button", {
383
398
  key: t,
384
399
  type: "button",
385
400
  class: "kun-editor__emoji",
386
401
  onClick: (t) => M(e)
387
- }, y(e), 9, Ve))), 128))], 512), [[x, !u || C.value === "emoji"]]),
388
- u ? w((m(), i("div", He, [T.value.length ? (m(!0), i(e, { key: 0 }, _(T.value, (t) => (m(), i("div", {
402
+ }, y(e), 9, Ue))), 128))], 512), [[x, !u || C.value === "emoji"]]),
403
+ u ? w((m(), i("div", We, [T.value.length ? (m(!0), i(e, { key: 0 }, _(T.value, (t) => (m(), i("div", {
389
404
  key: t.name,
390
405
  class: "kun-editor__pack"
391
- }, [a("div", Ue, y(t.name), 1), a("div", We, [(m(!0), i(e, null, _(t.stickers, (e, t) => (m(), i("button", {
406
+ }, [a("div", Ge, y(t.name), 1), a("div", Ke, [(m(!0), i(e, null, _(t.stickers, (e, t) => (m(), i("button", {
392
407
  key: t,
393
408
  type: "button",
394
409
  class: "kun-editor__sticker",
@@ -398,28 +413,28 @@ var X = Symbol("kun-editor-context"), be = [
398
413
  src: e.src,
399
414
  alt: e.name,
400
415
  loading: "lazy"
401
- }, null, 8, Ke)], 8, Ge))), 128))])]))), 128)) : (m(), i("div", qe, y(D.value ? h.value.failed : h.value.empty), 1))], 512)), [[x, C.value === "sticker"]]) : r("", !0)
416
+ }, null, 8, Je)], 8, qe))), 128))])]))), 128)) : (m(), i("div", Ye, y(D.value ? h.value.failed : h.value.empty), 1))], 512)), [[x, C.value === "sticker"]]) : r("", !0)
402
417
  ], 512), [[x, v.value]])], 512));
403
418
  }
404
- }), Ye = {
419
+ }), Ze = {
405
420
  class: "kun-editor__format-toolbar",
406
421
  role: "toolbar"
407
- }, Xe = ["aria-label"], Ze = {
422
+ }, Qe = ["aria-label"], $e = {
408
423
  value: "",
409
424
  disabled: "",
410
425
  selected: ""
411
- }, Qe = ["value"], $e = [
426
+ }, et = ["value"], tt = [
412
427
  "title",
413
428
  "aria-label",
414
429
  "onClick"
415
- ], et = ["innerHTML"], tt = ["title", "aria-label"], nt = ["innerHTML"], rt = /* @__PURE__ */ s({
430
+ ], nt = ["innerHTML"], rt = ["title", "aria-label"], it = ["innerHTML"], at = /* @__PURE__ */ s({
416
431
  __name: "EditorToolbar",
417
432
  setup(n) {
418
433
  let [, s] = k(), c = l(X), u = t(() => c?.adapters.uploadImage), d = t(() => c?.features.sticker !== !1), f = t(() => (c?.locale ?? "zh-cn").toLowerCase().startsWith("en")), p = (e, t) => {
419
- s()?.action(U(e, t));
434
+ s()?.action(W(e, t));
420
435
  }, h = () => {
421
436
  let e = window.prompt(f.value ? "Link URL" : "链接 URL")?.trim();
422
- e && p(G.key, { href: e });
437
+ e && p(J.key, { href: e });
423
438
  }, v = t(() => {
424
439
  let e = f.value;
425
440
  return {
@@ -459,22 +474,22 @@ var X = Symbol("kun-editor-context"), be = [
459
474
  {
460
475
  svg: $.bold,
461
476
  title: v.value.bold,
462
- run: () => p(fe.key)
477
+ run: () => p(pe.key)
463
478
  },
464
479
  {
465
480
  svg: $.italic,
466
481
  title: v.value.italic,
467
- run: () => p(q.key)
482
+ run: () => p(de.key)
468
483
  },
469
484
  {
470
485
  svg: $.strike,
471
486
  title: v.value.strike,
472
- run: () => p(J.key)
487
+ run: () => p(_e.key)
473
488
  },
474
489
  {
475
490
  svg: $.code,
476
491
  title: v.value.code,
477
- run: () => p(de.key)
492
+ run: () => p(fe.key)
478
493
  },
479
494
  {
480
495
  svg: $.link,
@@ -486,17 +501,17 @@ var X = Symbol("kun-editor-context"), be = [
486
501
  {
487
502
  svg: $.bulletList,
488
503
  title: v.value.bulletList,
489
- run: () => p(me.key)
504
+ run: () => p(he.key)
490
505
  },
491
506
  {
492
507
  svg: $.orderedList,
493
508
  title: v.value.orderedList,
494
- run: () => p(he.key)
509
+ run: () => p(ge.key)
495
510
  },
496
511
  {
497
512
  svg: $.quote,
498
513
  title: v.value.quote,
499
- run: () => p(pe.key)
514
+ run: () => p(me.key)
500
515
  },
501
516
  {
502
517
  svg: $.codeBlock,
@@ -512,29 +527,29 @@ var X = Symbol("kun-editor-context"), be = [
512
527
  [{
513
528
  svg: $.spoiler,
514
529
  title: v.value.spoiler,
515
- run: () => p(W.key)
530
+ run: () => p(q.key)
516
531
  }]
517
532
  ]), w = g(null), T = () => w.value?.click(), E = (e) => {
518
533
  let t = e.target, n = t.files?.[0];
519
534
  t.value = "";
520
535
  let r = u.value;
521
536
  !n || !r || s()?.action((e) => {
522
- K(e.get(F), n, {
537
+ se(e.get(I), n, {
523
538
  uploadImage: r,
524
539
  notify: c?.adapters.notify,
525
540
  locale: c?.locale
526
541
  });
527
542
  });
528
543
  };
529
- return (t, n) => (m(), i("div", Ye, [
544
+ return (t, n) => (m(), i("div", Ze, [
530
545
  a("select", {
531
546
  class: "kun-editor__heading-select",
532
547
  "aria-label": v.value.textSize,
533
548
  onChange: S
534
- }, [a("option", Ze, y(v.value.textSize), 1), (m(!0), i(e, null, _(x.value, (e) => (m(), i("option", {
549
+ }, [a("option", $e, y(v.value.textSize), 1), (m(!0), i(e, null, _(x.value, (e) => (m(), i("option", {
535
550
  key: e.level,
536
551
  value: e.level
537
- }, y(e.label), 9, Qe))), 128))], 40, Xe),
552
+ }, y(e.label), 9, et))), 128))], 40, Qe),
538
553
  (m(!0), i(e, null, _(C.value, (t, r) => (m(), i(e, { key: r }, [n[0] ||= a("span", {
539
554
  class: "kun-editor__toolbar-divider",
540
555
  "aria-hidden": "true"
@@ -548,7 +563,7 @@ var X = Symbol("kun-editor-context"), be = [
548
563
  }, [a("span", {
549
564
  class: "kun-editor__icon",
550
565
  innerHTML: e.svg
551
- }, null, 8, et)], 8, $e))), 128))], 64))), 128)),
566
+ }, null, 8, nt)], 8, tt))), 128))], 64))), 128)),
552
567
  u.value ? (m(), i(e, { key: 0 }, [
553
568
  n[1] ||= a("span", {
554
569
  class: "kun-editor__toolbar-divider",
@@ -563,7 +578,7 @@ var X = Symbol("kun-editor-context"), be = [
563
578
  }, [a("span", {
564
579
  class: "kun-editor__icon",
565
580
  innerHTML: b($).image
566
- }, null, 8, nt)], 8, tt),
581
+ }, null, 8, it)], 8, rt),
567
582
  a("input", {
568
583
  ref_key: "fileInput",
569
584
  ref: w,
@@ -576,28 +591,28 @@ var X = Symbol("kun-editor-context"), be = [
576
591
  d.value ? (m(), i(e, { key: 1 }, [n[2] ||= a("span", {
577
592
  class: "kun-editor__toolbar-divider",
578
593
  "aria-hidden": "true"
579
- }, null, -1), o(Je)], 64)) : r("", !0)
594
+ }, null, -1), o(Xe)], 64)) : r("", !0)
580
595
  ]));
581
596
  }
582
- }), it = /* @__PURE__ */ s({
597
+ }), ot = /* @__PURE__ */ s({
583
598
  __name: "ToolbarHost",
584
599
  setup(e) {
585
600
  let [, t] = k(), n = l(X, void 0), r = (e, n) => {
586
- t()?.action(U(e, n));
601
+ t()?.action(W(e, n));
587
602
  }, i = () => {
588
- t()?.action((e) => e.get(F).focus());
603
+ t()?.action((e) => e.get(I).focus());
589
604
  }, a = {
590
605
  run: r,
591
606
  insertText: (e) => {
592
607
  t()?.action((t) => {
593
- let n = t.get(F);
608
+ let n = t.get(I);
594
609
  n.dispatch(n.state.tr.insertText(e));
595
610
  }), i();
596
611
  },
597
612
  uploadImage: (e) => {
598
613
  let r = n?.adapters.uploadImage, i = t();
599
614
  !r || !i || i.action((t) => {
600
- K(t.get(F), e, {
615
+ se(t.get(I), e, {
601
616
  uploadImage: r,
602
617
  notify: n?.adapters.notify,
603
618
  locale: n?.locale
@@ -605,7 +620,7 @@ var X = Symbol("kun-editor-context"), be = [
605
620
  });
606
621
  },
607
622
  insertLink: (e) => {
608
- r(G.key, e), i();
623
+ r(J.key, e), i();
609
624
  },
610
625
  insertQuote: (e) => {
611
626
  r(re.key, e), i();
@@ -626,68 +641,91 @@ var X = Symbol("kun-editor-context"), be = [
626
641
  };
627
642
  return (e, t) => v(e.$slots, "default", d(c(a)));
628
643
  }
629
- }), at = /* @__PURE__ */ s({
644
+ }), st = /* @__PURE__ */ s({
630
645
  __name: "MarkdownSource",
631
646
  props: {
632
647
  modelValue: {},
633
648
  readonly: { type: Boolean }
634
649
  },
635
650
  emits: ["update:modelValue"],
636
- setup(e, { emit: t }) {
637
- let n = e, r = t, a = g(null), o = null, s = ge.define(), c = (e) => _e.create({
651
+ setup(e, { expose: t, emit: n }) {
652
+ let r = e, a = n, o = g(null), s = null, c = ve.define(), l = (e) => ye.create({
638
653
  doc: e,
639
654
  extensions: [
640
655
  ie(),
641
656
  Y.lineWrapping,
642
- ye,
643
- ve(),
644
- Y.editable.of(!n.readonly),
657
+ xe,
658
+ be(),
659
+ Y.editable.of(!r.readonly),
645
660
  Y.updateListener.of((e) => {
646
- e.docChanged && !e.transactions.some((e) => e.annotation(s)) && r("update:modelValue", e.state.doc.toString());
661
+ e.docChanged && !e.transactions.some((e) => e.annotation(c)) && a("update:modelValue", e.state.doc.toString());
647
662
  })
648
663
  ]
649
664
  });
650
- return p(() => {
651
- a.value && (o = new Y({
652
- state: c(n.modelValue),
653
- parent: a.value
665
+ p(() => {
666
+ o.value && (s = new Y({
667
+ state: l(r.modelValue),
668
+ parent: o.value
654
669
  }));
655
670
  }), f(() => {
656
- o?.destroy(), o = null;
657
- }), S(() => n.modelValue, (e) => {
658
- if (!o || o.state.doc.toString() === e) return;
659
- let { anchor: t, head: n } = o.state.selection.main, r = e.length;
660
- o.dispatch({
671
+ s?.destroy(), s = null;
672
+ });
673
+ let u = /^\s{0,3}(?:```|~~~)/, d = /^ {0,3}#{1,6}\s+/;
674
+ return t({ scrollToHeading: (e) => {
675
+ if (!s) return;
676
+ let { doc: t } = s.state, n = 0, r = !1, i = -1;
677
+ for (let a = 1; a <= t.lines; a += 1) {
678
+ let o = t.line(a);
679
+ if (u.test(o.text)) {
680
+ r = !r;
681
+ continue;
682
+ }
683
+ if (!r && d.test(o.text)) {
684
+ if (n === e) {
685
+ i = o.from;
686
+ break;
687
+ }
688
+ n += 1;
689
+ }
690
+ }
691
+ i < 0 || (s.dispatch({
692
+ selection: { anchor: i },
693
+ scrollIntoView: !0
694
+ }), s.focus());
695
+ } }), S(() => r.modelValue, (e) => {
696
+ if (!s || s.state.doc.toString() === e) return;
697
+ let { anchor: t, head: n } = s.state.selection.main, r = e.length;
698
+ s.dispatch({
661
699
  changes: {
662
700
  from: 0,
663
- to: o.state.doc.length,
701
+ to: s.state.doc.length,
664
702
  insert: e
665
703
  },
666
704
  selection: {
667
705
  anchor: Math.min(t, r),
668
706
  head: Math.min(n, r)
669
707
  },
670
- annotations: s.of(!0)
708
+ annotations: c.of(!0)
671
709
  });
672
710
  }), (e, t) => (m(), i("div", {
673
711
  ref_key: "host",
674
- ref: a,
712
+ ref: o,
675
713
  class: "kun-editor__source"
676
714
  }, null, 512));
677
715
  }
678
- }), ot = ["data-mode"], st = {
716
+ }), ct = ["data-mode"], lt = {
679
717
  key: 0,
680
718
  class: "kun-editor__toolbar",
681
719
  role: "tablist"
682
- }, ct = [
720
+ }, ut = [
683
721
  "aria-selected",
684
722
  "data-active",
685
723
  "onClick"
686
- ], lt = ["title", "aria-label"], ut = [
724
+ ], dt = ["title", "aria-label"], ft = [
687
725
  "data-active",
688
726
  "title",
689
727
  "aria-pressed"
690
- ], dt = ["data-swap"], ft = { class: "kun-editor__wysiwyg kun-editor__pane" }, pt = /* @__PURE__ */ s({
728
+ ], pt = ["data-swap"], mt = { class: "kun-editor__wysiwyg kun-editor__pane" }, ht = /* @__PURE__ */ s({
691
729
  __name: "KunEditor",
692
730
  props: {
693
731
  modelValue: {},
@@ -714,7 +752,7 @@ var X = Symbol("kun-editor-context"), be = [
714
752
  default: !0
715
753
  }
716
754
  },
717
- emits: ["update:modelValue"],
755
+ emits: ["update:modelValue", "update:headings"],
718
756
  setup(s, { expose: l, emit: p }) {
719
757
  let T = [
720
758
  "bold",
@@ -723,7 +761,7 @@ var X = Symbol("kun-editor-context"), be = [
723
761
  "code",
724
762
  "link"
725
763
  ], E = s, O = p;
726
- h(X, {
764
+ S(() => E.modelValue, (e) => O("update:headings", ee(e)), { immediate: !0 }), h(X, {
727
765
  get adapters() {
728
766
  return E.adapters;
729
767
  },
@@ -765,7 +803,7 @@ var X = Symbol("kun-editor-context"), be = [
765
803
  scrollSync: "同步滚动"
766
804
  }), z = g(null), B = null, V = null, H = null, U = () => {
767
805
  B?.(), B = null, V = null;
768
- }, ee = () => {
806
+ }, W = () => {
769
807
  U();
770
808
  let e = z.value;
771
809
  if (!e) return;
@@ -784,13 +822,16 @@ var X = Symbol("kun-editor-context"), be = [
784
822
  };
785
823
  };
786
824
  S([j, F], ([e, t]) => {
787
- U(), e === "split" && t && u(ee);
825
+ U(), e === "split" && t && u(W);
788
826
  }), f(U);
789
- let te = t(() => E.readonly || j.value === "split"), W = (e) => O("update:modelValue", e), G = g(null);
827
+ let te = t(() => E.readonly || j.value === "split"), G = (e) => O("update:modelValue", e), K = g(null), q = g(null);
790
828
  return l({
791
- insertQuote: (e) => G.value?.insertQuote(e),
792
- insertMention: (e) => G.value?.insertMention(e),
793
- focus: () => G.value?.focus()
829
+ insertQuote: (e) => K.value?.insertQuote(e),
830
+ insertMention: (e) => K.value?.insertMention(e),
831
+ focus: () => K.value?.focus(),
832
+ scrollToHeading: (e) => {
833
+ j.value === "source" || j.value === "split" ? q.value?.scrollToHeading(e) : K.value?.scrollToHeading(e);
834
+ }
794
835
  }), (t, l) => (m(), i("div", {
795
836
  ref_key: "rootEl",
796
837
  ref: z,
@@ -806,43 +847,45 @@ var X = Symbol("kun-editor-context"), be = [
806
847
  swap: P,
807
848
  scrollSync: F.value,
808
849
  toggleScrollSync: I
809
- }, () => [s.views.length > 1 ? (m(), i("div", st, [(m(!0), i(e, null, _(s.views, (e) => (m(), i("button", {
850
+ }, () => [s.views.length > 1 ? (m(), i("div", lt, [(m(!0), i(e, null, _(s.views, (e) => (m(), i("button", {
810
851
  key: e,
811
852
  type: "button",
812
853
  class: "kun-editor__tab",
813
854
  "aria-selected": j.value === e,
814
855
  "data-active": j.value === e,
815
856
  onClick: (t) => M(e)
816
- }, y(R.value[e]), 9, ct))), 128)), j.value === "split" ? (m(), i(e, { key: 0 }, [a("button", {
857
+ }, y(R.value[e]), 9, ut))), 128)), j.value === "split" ? (m(), i(e, { key: 0 }, [a("button", {
817
858
  type: "button",
818
859
  class: "kun-editor__tab kun-editor__swap",
819
860
  title: R.value.swap,
820
861
  "aria-label": R.value.swap,
821
862
  onClick: l[0] ||= (e) => P()
822
- }, " ⇄ ", 8, lt), a("button", {
863
+ }, " ⇄ ", 8, dt), a("button", {
823
864
  type: "button",
824
865
  class: "kun-editor__tab",
825
866
  "data-active": F.value,
826
867
  title: R.value.scrollSync,
827
868
  "aria-pressed": F.value,
828
869
  onClick: l[1] ||= (e) => I()
829
- }, y(R.value.scrollSync), 9, ut)], 64)) : r("", !0)])) : r("", !0)]), o(b(D), null, {
870
+ }, y(R.value.scrollSync), 9, ft)], 64)) : r("", !0)])) : r("", !0)]), o(b(D), null, {
830
871
  default: C(() => [o(b(A), null, {
831
- default: C(() => [w(a("div", null, [o(it, null, {
832
- default: C((e) => [v(t.$slots, "toolbar", d(c(e)), () => [o(rt)])]),
872
+ default: C(() => [w(a("div", null, [o(ot, null, {
873
+ default: C((e) => [v(t.$slots, "toolbar", d(c(e)), () => [o(at)])]),
833
874
  _: 3
834
875
  })], 512), [[x, j.value === "wysiwyg" && !s.readonly]]), a("div", {
835
876
  class: "kun-editor__panes",
836
877
  "data-swap": N.value
837
- }, [j.value === "source" || j.value === "split" ? (m(), n(at, {
878
+ }, [j.value === "source" || j.value === "split" ? (m(), n(st, {
838
879
  key: 0,
880
+ ref_key: "source",
881
+ ref: q,
839
882
  class: "kun-editor__pane",
840
883
  "model-value": s.modelValue,
841
884
  readonly: s.readonly,
842
- "onUpdate:modelValue": W
843
- }, null, 8, ["model-value", "readonly"])) : r("", !0), w(a("div", ft, [o(Me, {
885
+ "onUpdate:modelValue": G
886
+ }, null, 8, ["model-value", "readonly"])) : r("", !0), w(a("div", mt, [o(Pe, {
844
887
  ref_key: "inner",
845
- ref: G,
888
+ ref: K,
846
889
  "model-value": s.modelValue,
847
890
  adapters: s.adapters,
848
891
  features: s.features,
@@ -852,7 +895,7 @@ var X = Symbol("kun-editor-context"), be = [
852
895
  "placeholder-mode": s.placeholderMode,
853
896
  active: j.value === "wysiwyg" && !s.readonly,
854
897
  "selection-toolbar": k.value,
855
- "onUpdate:modelValue": W
898
+ "onUpdate:modelValue": G
856
899
  }, null, 8, [
857
900
  "model-value",
858
901
  "adapters",
@@ -863,14 +906,14 @@ var X = Symbol("kun-editor-context"), be = [
863
906
  "placeholder-mode",
864
907
  "active",
865
908
  "selection-toolbar"
866
- ])], 512), [[x, j.value === "wysiwyg" || j.value === "split"]])], 8, dt)]),
909
+ ])], 512), [[x, j.value === "wysiwyg" || j.value === "split"]])], 8, pt)]),
867
910
  _: 3
868
911
  })]),
869
912
  _: 3
870
- })], 8, ot));
913
+ })], 8, ct));
871
914
  }
872
- }), mt = { install(e) {
873
- e.component("KunEditor", pt);
915
+ }), gt = { install(e) {
916
+ e.component("KunEditor", ht);
874
917
  } };
875
918
  //#endregion
876
- export { Ne as EMOJI, pt as KunEditor, mt as KunEditorPlugin };
919
+ export { Fe as EMOJI, ht as KunEditor, gt as KunEditorPlugin, N as parseHeadings };
package/dist/types.d.ts CHANGED
@@ -83,5 +83,11 @@ export interface KunEditorExpose {
83
83
  }): void;
84
84
  /** Focus the WYSIWYG editor. */
85
85
  focus(): void;
86
+ /**
87
+ * Scroll to the index-th heading (matching the `update:headings` outline order)
88
+ * in the active view, placing the caret there when editable. Powers a
89
+ * host-rendered table of contents.
90
+ */
91
+ scrollToHeading(index: number): void;
86
92
  }
87
93
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAA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,MAAM,GAAG,IAAI,CAAA;CACrC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-vue",
3
- "version": "0.26.0",
3
+ "version": "0.27.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.26.0"
43
+ "@kungal/editor-core": "0.27.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.26.0"
83
+ "@kungal/editor-core": "0.27.0"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "vite build && vue-tsc -p tsconfig.build.json",