@kungal/editor-vue 0.21.0 → 0.23.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,66 @@
1
1
  # @kungal/editor-vue
2
2
 
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 78e637e: `<KunEditor>` gains a `views` prop to control which view modes the switch offers.
8
+
9
+ The split view is great on a full editor but heavy in a small reply/comment box —
10
+ and there was no way to opt out per-editor (all or nothing). Now pass `views`:
11
+
12
+ ```vue
13
+ <!-- edit page: all three (default) -->
14
+ <KunEditor v-model="md" />
15
+ <!-- reply / comment: no split -->
16
+ <KunEditor v-model="md" :views="['wysiwyg', 'source']" />
17
+ <!-- just WYSIWYG: the switch bar is hidden entirely -->
18
+ <KunEditor v-model="md" :views="['wysiwyg']" />
19
+ ```
20
+
21
+ - Default `['wysiwyg', 'source', 'split']`. The view switch renders only the
22
+ offered modes, and disappears when a single mode is offered. If `views` changes
23
+ to exclude the active mode, it falls back to the first offered.
24
+ - `KunEditorViewSwitchApi` gains `views`; the default view switch and
25
+ `<KunEditorViewSwitch>` (editor-nuxt) both render from it.
26
+
27
+ Verified in the docs production build: an editor with `:views="['wysiwyg','source']"`
28
+ shows only 预览/Markdown (no 分栏), while default editors still show all three; 0
29
+ console errors.
30
+
31
+ ### Patch Changes
32
+
33
+ - @kungal/editor-core@0.23.0
34
+
35
+ ## 0.22.0
36
+
37
+ ### Minor Changes
38
+
39
+ - fbbb761: Add a selection bubble toolbar (floating format menu on text selection).
40
+
41
+ Selecting text now shows a floating inline-format menu (bold / italic /
42
+ strikethrough / inline code) over the selection — the Medium/Notion pattern. It's
43
+ built the Milkdown v7 way: a tooltip plugin view (`@milkdown/kit/plugin/tooltip`'s
44
+ `tooltipFactory` + `TooltipProvider`, rendered via `@prosemirror-adapter/vue` —
45
+ the same plugin-view mechanism as the @mention dropdown). `TooltipProvider`
46
+ handles show/hide/positioning (floating-ui): shown only on a non-empty text
47
+ selection while focused, and never when read-only (so it's inert in the split
48
+ preview). Buttons run the same toggle commands as the fixed toolbar.
49
+
50
+ - `<KunEditor>` gains a `selectionToolbar` prop (default `true`; set `false` to
51
+ disable).
52
+ - Headless: the bubble is class hooks only (`.kun-editor__bubble` /
53
+ `.kun-editor__bubble-btn`, with `[data-show]`), like the @mention dropdown —
54
+ styled by the reference `kun-editor.css`. editor-vue still ships zero CSS.
55
+
56
+ Verified in the docs production build: selecting text shows the positioned bubble;
57
+ clicking bold marks the selection (`**…**`); collapsing the selection hides it; 0
58
+ console errors.
59
+
60
+ ### Patch Changes
61
+
62
+ - @kungal/editor-core@0.22.0
63
+
3
64
  ## 0.21.0
4
65
 
5
66
  ### Minor Changes
@@ -1,5 +1,6 @@
1
1
  import type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale } from '@kungal/editor-core';
2
2
  import type { KunEditorExpose } from '../types';
3
+ type ViewMode = 'wysiwyg' | 'source' | 'split';
3
4
  type __VLS_Props = {
4
5
  /** Bound markdown (v-model). */
5
6
  modelValue: string;
@@ -13,11 +14,18 @@ type __VLS_Props = {
13
14
  readonly?: boolean;
14
15
  /** Placeholder text shown while the editor is empty. */
15
16
  placeholder?: string;
17
+ /**
18
+ * Which view modes to offer in the switch. Default all three. Drop `'split'`
19
+ * (or use just `['wysiwyg']`) for compact editors like a reply/comment box —
20
+ * a single-mode `views` hides the switch bar entirely.
21
+ */
22
+ views?: ViewMode[];
16
23
  /** Sync scrolling between the split panes. Default `true`; set `false` to
17
24
  * disable (or toggle it at runtime via the view-switch API). */
18
25
  scrollSync?: boolean;
26
+ /** Show a floating format toolbar on text selection. Default `true`. */
27
+ selectionToolbar?: boolean;
19
28
  };
20
- type ViewMode = 'wysiwyg' | 'source' | 'split';
21
29
  declare var __VLS_1: {
22
30
  mode: ViewMode;
23
31
  setMode: (m: ViewMode) => void;
@@ -28,6 +36,7 @@ declare var __VLS_1: {
28
36
  swap: string;
29
37
  scrollSync: string;
30
38
  };
39
+ views: ViewMode[];
31
40
  swapped: boolean;
32
41
  swap: () => void;
33
42
  scrollSync: boolean;
@@ -64,6 +73,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, KunEditorEx
64
73
  locale: KunEditorLocale;
65
74
  readonly: boolean;
66
75
  placeholder: string;
76
+ selectionToolbar: boolean;
77
+ views: ViewMode[];
67
78
  scrollSync: boolean;
68
79
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
80
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1 +1 @@
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,CAtS+C;;;;;;;;;;;;;;;CAitBiB,CAAE;AAClE,KAAK,WAAW,GAAG,EAAE,GACnB;I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E,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAC;AA6YJ,QAAA,IAAI,OAAO;;iBAjWS,QAAQ;;;;;;;;;;;;;CAiWP,EAAE,QAAQ;iEAtb/B,CA/S+C;;;;;;;;;;;;;;;CAquBiB,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;;;;;cA5aD,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;iBAEJ,MAAM;sBAWD,OAAO;WALlB,QAAQ,EAAE;gBAGL,OAAO;6EAgatB,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"}
@@ -7,6 +7,7 @@ type __VLS_Props = {
7
7
  locale: KunEditorLocale;
8
8
  readonly: boolean;
9
9
  placeholder: string;
10
+ selectionToolbar: boolean;
10
11
  };
11
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, KunEditorExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
13
  "update:modelValue": (markdown: string) => any;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AA4MA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAI5B,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;IACnB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAC;AA4JF,QAAA,MAAM,YAAY;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,4 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
4
+ //# sourceMappingURL=SelectionTooltip.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionTooltip.vue.d.ts","sourceRoot":"","sources":["../../src/components/SelectionTooltip.vue"],"names":[],"mappings":"AAyMA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
package/dist/index.js CHANGED
@@ -4,36 +4,37 @@ import { ProsemirrorAdapterProvider as A, usePluginViewContext as j, usePluginVi
4
4
  import { Editor as N, defaultValueCtx as P, editorViewCtx as F, editorViewOptionsCtx as I, rootCtx as L } from "@milkdown/kit/core";
5
5
  import { listenerCtx as R } from "@milkdown/kit/plugin/listener";
6
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";
7
+ import { TooltipProvider as V, tooltipFactory as H } from "@milkdown/kit/plugin/tooltip";
8
+ import { callCommand as U, replaceAll as W } from "@milkdown/kit/utils";
9
+ import { createKunEditorPlugins as G, insertKunSpoilerCommand as ee, insertMentionCommand as K, insertQuoteCommand as q, kunCM as te, mentionId as ne, setHeadingCommand as re, startImageUpload as J } from "@kungal/editor-core/preset";
10
+ import { TextSelection as ie } from "@milkdown/kit/prose/state";
11
+ import { createCodeBlockCommand as ae, insertHrCommand as oe, insertImageCommand as se, toggleEmphasisCommand as ce, toggleInlineCodeCommand as le, toggleStrongCommand as ue, wrapInBlockquoteCommand as de, wrapInBulletListCommand as fe, wrapInOrderedListCommand as pe } from "@milkdown/kit/preset/commonmark";
12
+ import { toggleStrikethroughCommand as me } from "@milkdown/kit/preset/gfm";
13
+ import { EditorState as he } from "@codemirror/state";
14
+ import { EditorView as Y } from "@codemirror/view";
15
+ import { markdown as ge } from "@codemirror/lang-markdown";
16
+ import { basicSetup as _e } from "codemirror";
16
17
  //#region src/context.ts
17
- var Y = Symbol("kun-editor-context"), _e = [
18
+ var X = Symbol("kun-editor-context"), ve = [
18
19
  "data-active",
19
20
  "onMousedown",
20
21
  "onMouseenter"
21
- ], ve = ["src", "alt"], ye = {
22
+ ], ye = ["src", "alt"], be = {
22
23
  key: 1,
23
24
  class: "kun-mention-dropdown__avatar kun-mention-dropdown__avatar--fallback"
24
- }, be = { class: "kun-mention-dropdown__name" }, xe = {
25
+ }, xe = { class: "kun-mention-dropdown__name" }, Se = {
25
26
  key: 1,
26
27
  class: "kun-mention-dropdown__hint"
27
- }, Se = {
28
+ }, Ce = {
28
29
  key: 2,
29
30
  class: "kun-mention-dropdown__hint"
30
- }, Ce = {
31
+ }, we = {
31
32
  key: 3,
32
33
  class: "kun-mention-dropdown__hint"
33
- }, we = /* @__PURE__ */ s({
34
+ }, Te = /* @__PURE__ */ s({
34
35
  __name: "MentionDropdown",
35
36
  setup(n) {
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
+ 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 ? {
37
38
  searching: "Searching…",
38
39
  empty: "No matching users",
39
40
  prompt: "Type a username to search"
@@ -73,13 +74,13 @@ var Y = Symbol("kun-editor-context"), _e = [
73
74
  }, I = (e) => {
74
75
  let t = d.value;
75
76
  if (!t || !O) return;
76
- let n = t.state.schema.nodes[te];
77
+ let n = t.state.schema.nodes[ne];
77
78
  if (!n) return;
78
79
  let r = n.create({
79
80
  userId: e.id,
80
81
  name: e.name
81
82
  }), { from: i, to: a } = O, o = t.state.tr.replaceWith(i, a, r), s = i + r.nodeSize;
82
- o.insertText(" ", s), o.setSelection(re.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
83
+ o.insertText(" ", s), o.setSelection(ie.create(o.doc, s + 1)), t.dispatch(o.scrollIntoView()), t.focus(), b.hide();
83
84
  }, L = (e) => {
84
85
  if (!x.value || !w.value.length) {
85
86
  x.value && e.key === "Escape" && (e.preventDefault(), b.hide());
@@ -136,9 +137,86 @@ var Y = Symbol("kun-editor-context"), _e = [
136
137
  src: e.avatar,
137
138
  alt: e.name,
138
139
  class: "kun-mention-dropdown__avatar"
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
+ }, null, 8, ye)) : (m(), i("span", be, y(e.name.charAt(0)), 1)), a("span", xe, y(e.name), 1)], 40, ve))), 128)) : D.value ? (m(), i("div", Se, y(u.value.searching), 1)) : C.value ? (m(), i("div", Ce, y(u.value.empty), 1)) : (m(), i("div", we, y(u.value.prompt), 1))], 512));
140
141
  }
141
- }), Te = /* @__PURE__ */ s({
142
+ }), 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
+ bold: Z("<path d=\"M6 4h8a4 4 0 0 1 0 8H6z\"/><path d=\"M6 12h9a4 4 0 0 1 0 8H6z\"/>"),
144
+ italic: Z("<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\"/>"),
145
+ strike: Z("<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\"/>"),
146
+ code: Z("<path d=\"m18 16 4-4-4-4\"/><path d=\"m6 8-4 4 4 4\"/><path d=\"m14.5 4-5 16\"/>"),
147
+ h1: Q("H1", 11),
148
+ h2: Q("H2", 11),
149
+ h3: Q("H3", 11),
150
+ bulletList: Z("<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\"/>"),
151
+ orderedList: Z("<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\"/>"),
152
+ quote: Z("<path d=\"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z\" fill=\"currentColor\" stroke=\"none\"/>"),
153
+ codeBlock: Z("<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\"/>"),
154
+ hr: Z("<line x1=\"4\" y1=\"12\" x2=\"20\" y2=\"12\"/>"),
155
+ image: Z("<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\"/>"),
156
+ spoiler: Z("<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\"/>"),
157
+ latex: Q("Σ", 15),
158
+ 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\"/>")
159
+ }, Ee = [
160
+ "title",
161
+ "aria-label",
162
+ "onMousedown"
163
+ ], De = ["innerHTML"], Oe = /* @__PURE__ */ s({
164
+ __name: "SelectionTooltip",
165
+ setup(n) {
166
+ 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) => {
167
+ s()?.action(U(e, t));
168
+ }, y = t(() => {
169
+ let e = u.value;
170
+ return [
171
+ {
172
+ svg: $.bold,
173
+ title: e ? "Bold" : "加粗",
174
+ run: () => v(ue.key)
175
+ },
176
+ {
177
+ svg: $.italic,
178
+ title: e ? "Italic" : "斜体",
179
+ run: () => v(ce.key)
180
+ },
181
+ {
182
+ svg: $.strike,
183
+ title: e ? "Strikethrough" : "删除线",
184
+ run: () => v(me.key)
185
+ },
186
+ {
187
+ svg: $.code,
188
+ title: e ? "Inline code" : "行内代码",
189
+ run: () => v(le.key)
190
+ }
191
+ ];
192
+ });
193
+ return p(() => {
194
+ h = new V({
195
+ content: d.value,
196
+ offset: 8
197
+ }), h.update(r.value, o.value);
198
+ }), S([r, o], () => {
199
+ h?.update(r.value, o.value);
200
+ }), f(() => {
201
+ h?.destroy();
202
+ }), (t, n) => (m(), i("div", {
203
+ ref_key: "divRef",
204
+ ref: d,
205
+ class: "kun-editor__bubble",
206
+ "data-show": "false"
207
+ }, [(m(!0), i(e, null, _(y.value, (e, t) => (m(), i("button", {
208
+ key: t,
209
+ type: "button",
210
+ class: "kun-editor__bubble-btn",
211
+ title: e.title,
212
+ "aria-label": e.title,
213
+ onMousedown: T((t) => e.run(), ["prevent"])
214
+ }, [a("span", {
215
+ class: "kun-editor__icon",
216
+ innerHTML: e.svg
217
+ }, null, 8, De)], 40, Ee))), 128))], 512));
218
+ }
219
+ }), ke = /* @__PURE__ */ s({
142
220
  __name: "MilkdownEditor",
143
221
  props: {
144
222
  modelValue: {},
@@ -146,80 +224,64 @@ var Y = Symbol("kun-editor-context"), _e = [
146
224
  features: {},
147
225
  locale: {},
148
226
  readonly: { type: Boolean },
149
- placeholder: {}
227
+ placeholder: {},
228
+ selectionToolbar: { type: Boolean }
150
229
  },
151
230
  emits: ["update:modelValue"],
152
231
  setup(e, { expose: t, emit: r }) {
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) => {
232
+ let i = e, a = r, o = i.modelValue, s = M(), c = B("kunMention"), l = i.features.mention !== !1 && !!i.adapters.searchMentionUsers && !!s, u = H("kunSelectionTooltip"), d = i.selectionToolbar && !!s, f = O((e) => {
154
233
  let t = N.make().config((t) => {
155
234
  t.set(L, e), t.set(P, i.modelValue), t.get(R).markdownUpdated((e, t, n) => {
156
235
  t !== n && (o = t, a("update:modelValue", t));
157
236
  }), t.update(I, (e) => ({
158
237
  ...e,
159
238
  editable: () => !i.readonly
160
- })), l && t.set(c.key, { view: s({ component: we }) });
161
- }).use(U(i.adapters, i.features, {
239
+ })), l && t.set(c.key, { view: s({ component: Te }) }), d && t.set(u.key, { view: s({ component: Oe }) });
240
+ }).use(G(i.adapters, i.features, {
162
241
  locale: i.locale,
163
242
  placeholder: i.placeholder
164
243
  }));
165
- return l && t.use(c), t;
244
+ return l && t.use(c), d && t.use(u), t;
166
245
  });
167
246
  S(() => i.modelValue, (e) => {
168
- e !== o && (o = e, u.get()?.action(H(e)));
247
+ e !== o && (o = e, f.get()?.action(W(e)));
169
248
  }), S(() => i.readonly, () => {
170
- u.get()?.action((e) => {
249
+ f.get()?.action((e) => {
171
250
  let t = e.get(F);
172
251
  t.dispatch(t.state.tr);
173
252
  });
174
253
  });
175
- let d = () => {
176
- u.get()?.action((e) => e.get(F).focus());
254
+ let p = () => {
255
+ f.get()?.action((e) => e.get(F).focus());
177
256
  };
178
257
  return t({
179
258
  insertQuote: (e) => {
180
- u.get()?.action(V(K.key, e)), d();
259
+ f.get()?.action(U(q.key, e)), p();
181
260
  },
182
261
  insertMention: (e) => {
183
- u.get()?.action(V(G.key, e)), d();
262
+ f.get()?.action(U(K.key, e)), p();
184
263
  },
185
- focus: d
264
+ focus: p
186
265
  }), (e, t) => (m(), n(b(E)));
187
266
  }
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 = [
267
+ }), Ae = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), je = [
206
268
  "title",
207
269
  "aria-label",
208
270
  "aria-expanded"
209
- ], De = ["innerHTML"], Oe = { class: "kun-editor__picker-panel" }, ke = {
271
+ ], Me = ["innerHTML"], Ne = { class: "kun-editor__picker-panel" }, Pe = {
210
272
  key: 0,
211
273
  class: "kun-editor__picker-tabs",
212
274
  role: "tablist"
213
- }, Ae = ["data-active"], je = ["data-active"], Me = { class: "kun-editor__emoji-grid" }, Ne = ["onClick"], Pe = {
275
+ }, Fe = ["data-active"], Ie = ["data-active"], Le = { class: "kun-editor__emoji-grid" }, Re = ["onClick"], ze = {
214
276
  key: 1,
215
277
  class: "kun-editor__sticker-body"
216
- }, Fe = { class: "kun-editor__pack-name" }, Ie = { class: "kun-editor__sticker-grid" }, Le = ["title", "onClick"], Re = ["src", "alt"], ze = {
278
+ }, Be = { class: "kun-editor__pack-name" }, Ve = { class: "kun-editor__sticker-grid" }, He = ["title", "onClick"], Ue = ["src", "alt"], We = {
217
279
  key: 1,
218
280
  class: "kun-editor__picker-hint"
219
- }, Be = /* @__PURE__ */ s({
281
+ }, Ge = /* @__PURE__ */ s({
220
282
  __name: "StickerPicker",
221
283
  setup(n) {
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 ? {
284
+ 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 ? {
223
285
  trigger: "Emoji & stickers",
224
286
  emoji: "Emoji",
225
287
  sticker: "Stickers",
@@ -252,7 +314,7 @@ var Y = Symbol("kun-editor-context"), _e = [
252
314
  n.dispatch(r.tr.insertText(e, r.selection.from));
253
315
  });
254
316
  }, N = (e, t) => {
255
- o()?.action(V(oe.key, {
317
+ o()?.action(U(se.key, {
256
318
  src: e,
257
319
  title: t,
258
320
  alt: t
@@ -271,29 +333,29 @@ var Y = Symbol("kun-editor-context"), _e = [
271
333
  onClick: A
272
334
  }, [a("span", {
273
335
  class: "kun-editor__icon",
274
- innerHTML: b(Q).smile
275
- }, null, 8, De)], 8, Ee), w(a("div", Oe, [
276
- u ? (m(), i("div", ke, [a("button", {
336
+ innerHTML: b($).smile
337
+ }, null, 8, Me)], 8, je), w(a("div", Ne, [
338
+ u ? (m(), i("div", Pe, [a("button", {
277
339
  type: "button",
278
340
  class: "kun-editor__picker-tab",
279
341
  "data-active": C.value === "emoji",
280
342
  onClick: n[0] ||= (e) => C.value = "emoji"
281
- }, y(h.value.emoji), 9, Ae), a("button", {
343
+ }, y(h.value.emoji), 9, Fe), a("button", {
282
344
  type: "button",
283
345
  class: "kun-editor__picker-tab",
284
346
  "data-active": C.value === "sticker",
285
347
  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", {
348
+ }, y(h.value.sticker), 9, Ie)])) : r("", !0),
349
+ w(a("div", Le, [(m(!0), i(e, null, _(b(Ae), (e, t) => (m(), i("button", {
288
350
  key: t,
289
351
  type: "button",
290
352
  class: "kun-editor__emoji",
291
353
  onClick: (t) => M(e)
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", {
354
+ }, y(e), 9, Re))), 128))], 512), [[x, !u || C.value === "emoji"]]),
355
+ u ? w((m(), i("div", ze, [T.value.length ? (m(!0), i(e, { key: 0 }, _(T.value, (t) => (m(), i("div", {
294
356
  key: t.name,
295
357
  class: "kun-editor__pack"
296
- }, [a("div", Fe, y(t.name), 1), a("div", Ie, [(m(!0), i(e, null, _(t.stickers, (e, t) => (m(), i("button", {
358
+ }, [a("div", Be, y(t.name), 1), a("div", Ve, [(m(!0), i(e, null, _(t.stickers, (e, t) => (m(), i("button", {
297
359
  key: t,
298
360
  type: "button",
299
361
  class: "kun-editor__sticker",
@@ -303,25 +365,25 @@ var Y = Symbol("kun-editor-context"), _e = [
303
365
  src: e.src,
304
366
  alt: e.name,
305
367
  loading: "lazy"
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)
368
+ }, null, 8, Ue)], 8, He))), 128))])]))), 128)) : (m(), i("div", We, y(D.value ? h.value.failed : h.value.empty), 1))], 512)), [[x, C.value === "sticker"]]) : r("", !0)
307
369
  ], 512), [[x, v.value]])], 512));
308
370
  }
309
- }), Ve = {
371
+ }), Ke = {
310
372
  class: "kun-editor__format-toolbar",
311
373
  role: "toolbar"
312
- }, He = ["aria-label"], Ue = {
374
+ }, qe = ["aria-label"], Je = {
313
375
  value: "",
314
376
  disabled: "",
315
377
  selected: ""
316
- }, We = ["value"], Ge = [
378
+ }, Ye = ["value"], Xe = [
317
379
  "title",
318
380
  "aria-label",
319
381
  "onClick"
320
- ], Ke = ["innerHTML"], qe = ["title", "aria-label"], Je = ["innerHTML"], Ye = /* @__PURE__ */ s({
382
+ ], Ze = ["innerHTML"], Qe = ["title", "aria-label"], $e = ["innerHTML"], et = /* @__PURE__ */ s({
321
383
  __name: "EditorToolbar",
322
384
  setup(n) {
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));
385
+ 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) => {
386
+ s()?.action(U(e, t));
325
387
  }, h = t(() => {
326
388
  let e = f.value;
327
389
  return {
@@ -354,83 +416,83 @@ var Y = Symbol("kun-editor-context"), _e = [
354
416
  }));
355
417
  }), x = (e) => {
356
418
  let t = e.target;
357
- p(ne.key, Number(t.value)), t.selectedIndex = 0;
419
+ p(re.key, Number(t.value)), t.selectedIndex = 0;
358
420
  }, S = t(() => [
359
421
  [
360
422
  {
361
- svg: Q.bold,
423
+ svg: $.bold,
362
424
  title: h.value.bold,
363
- run: () => p(le.key)
425
+ run: () => p(ue.key)
364
426
  },
365
427
  {
366
- svg: Q.italic,
428
+ svg: $.italic,
367
429
  title: h.value.italic,
368
- run: () => p(se.key)
430
+ run: () => p(ce.key)
369
431
  },
370
432
  {
371
- svg: Q.strike,
433
+ svg: $.strike,
372
434
  title: h.value.strike,
373
- run: () => p(pe.key)
435
+ run: () => p(me.key)
374
436
  },
375
437
  {
376
- svg: Q.code,
438
+ svg: $.code,
377
439
  title: h.value.code,
378
- run: () => p(ce.key)
440
+ run: () => p(le.key)
379
441
  }
380
442
  ],
381
443
  [
382
444
  {
383
- svg: Q.bulletList,
445
+ svg: $.bulletList,
384
446
  title: h.value.bulletList,
385
- run: () => p(de.key)
447
+ run: () => p(fe.key)
386
448
  },
387
449
  {
388
- svg: Q.orderedList,
450
+ svg: $.orderedList,
389
451
  title: h.value.orderedList,
390
- run: () => p(fe.key)
452
+ run: () => p(pe.key)
391
453
  },
392
454
  {
393
- svg: Q.quote,
455
+ svg: $.quote,
394
456
  title: h.value.quote,
395
- run: () => p(ue.key)
457
+ run: () => p(de.key)
396
458
  },
397
459
  {
398
- svg: Q.codeBlock,
460
+ svg: $.codeBlock,
399
461
  title: h.value.codeBlock,
400
- run: () => p(ie.key, "")
462
+ run: () => p(ae.key, "")
401
463
  },
402
464
  {
403
- svg: Q.hr,
465
+ svg: $.hr,
404
466
  title: h.value.hr,
405
- run: () => p(ae.key)
467
+ run: () => p(oe.key)
406
468
  }
407
469
  ],
408
470
  [{
409
- svg: Q.spoiler,
471
+ svg: $.spoiler,
410
472
  title: h.value.spoiler,
411
- run: () => p(W.key)
473
+ run: () => p(ee.key)
412
474
  }]
413
475
  ]), C = g(null), w = () => C.value?.click(), T = (e) => {
414
476
  let t = e.target, n = t.files?.[0];
415
477
  t.value = "";
416
478
  let r = u.value;
417
479
  !n || !r || s()?.action((e) => {
418
- q(e.get(F), n, {
480
+ J(e.get(F), n, {
419
481
  uploadImage: r,
420
482
  notify: c?.adapters.notify,
421
483
  locale: c?.locale
422
484
  });
423
485
  });
424
486
  };
425
- return (t, n) => (m(), i("div", Ve, [
487
+ return (t, n) => (m(), i("div", Ke, [
426
488
  a("select", {
427
489
  class: "kun-editor__heading-select",
428
490
  "aria-label": h.value.textSize,
429
491
  onChange: x
430
- }, [a("option", Ue, y(h.value.textSize), 1), (m(!0), i(e, null, _(v.value, (e) => (m(), i("option", {
492
+ }, [a("option", Je, y(h.value.textSize), 1), (m(!0), i(e, null, _(v.value, (e) => (m(), i("option", {
431
493
  key: e.level,
432
494
  value: e.level
433
- }, y(e.label), 9, We))), 128))], 40, He),
495
+ }, y(e.label), 9, Ye))), 128))], 40, qe),
434
496
  (m(!0), i(e, null, _(S.value, (t, r) => (m(), i(e, { key: r }, [n[0] ||= a("span", {
435
497
  class: "kun-editor__toolbar-divider",
436
498
  "aria-hidden": "true"
@@ -444,7 +506,7 @@ var Y = Symbol("kun-editor-context"), _e = [
444
506
  }, [a("span", {
445
507
  class: "kun-editor__icon",
446
508
  innerHTML: e.svg
447
- }, null, 8, Ke)], 8, Ge))), 128))], 64))), 128)),
509
+ }, null, 8, Ze)], 8, Xe))), 128))], 64))), 128)),
448
510
  u.value ? (m(), i(e, { key: 0 }, [
449
511
  n[1] ||= a("span", {
450
512
  class: "kun-editor__toolbar-divider",
@@ -458,8 +520,8 @@ var Y = Symbol("kun-editor-context"), _e = [
458
520
  onClick: w
459
521
  }, [a("span", {
460
522
  class: "kun-editor__icon",
461
- innerHTML: b(Q).image
462
- }, null, 8, Je)], 8, qe),
523
+ innerHTML: b($).image
524
+ }, null, 8, $e)], 8, Qe),
463
525
  a("input", {
464
526
  ref_key: "fileInput",
465
527
  ref: C,
@@ -472,14 +534,14 @@ var Y = Symbol("kun-editor-context"), _e = [
472
534
  d.value ? (m(), i(e, { key: 1 }, [n[2] ||= a("span", {
473
535
  class: "kun-editor__toolbar-divider",
474
536
  "aria-hidden": "true"
475
- }, null, -1), o(Be)], 64)) : r("", !0)
537
+ }, null, -1), o(Ge)], 64)) : r("", !0)
476
538
  ]));
477
539
  }
478
- }), Xe = /* @__PURE__ */ s({
540
+ }), tt = /* @__PURE__ */ s({
479
541
  __name: "ToolbarHost",
480
542
  setup(e) {
481
- let [, t] = k(), n = l(Y, void 0), r = (e, n) => {
482
- t()?.action(V(e, n));
543
+ let [, t] = k(), n = l(X, void 0), r = (e, n) => {
544
+ t()?.action(U(e, n));
483
545
  }, i = () => {
484
546
  t()?.action((e) => e.get(F).focus());
485
547
  }, a = {
@@ -493,7 +555,7 @@ var Y = Symbol("kun-editor-context"), _e = [
493
555
  uploadImage: (e) => {
494
556
  let r = n?.adapters.uploadImage, i = t();
495
557
  !r || !i || i.action((t) => {
496
- q(t.get(F), e, {
558
+ J(t.get(F), e, {
497
559
  uploadImage: r,
498
560
  notify: n?.adapters.notify,
499
561
  locale: n?.locale
@@ -501,10 +563,10 @@ var Y = Symbol("kun-editor-context"), _e = [
501
563
  });
502
564
  },
503
565
  insertQuote: (e) => {
504
- r(K.key, e), i();
566
+ r(q.key, e), i();
505
567
  },
506
568
  insertMention: (e) => {
507
- r(G.key, e), i();
569
+ r(K.key, e), i();
508
570
  },
509
571
  focus: i,
510
572
  get adapters() {
@@ -519,7 +581,7 @@ var Y = Symbol("kun-editor-context"), _e = [
519
581
  };
520
582
  return (e, t) => v(e.$slots, "default", d(c(a)));
521
583
  }
522
- }), Ze = /* @__PURE__ */ s({
584
+ }), nt = /* @__PURE__ */ s({
523
585
  __name: "MarkdownSource",
524
586
  props: {
525
587
  modelValue: {},
@@ -527,21 +589,21 @@ var Y = Symbol("kun-editor-context"), _e = [
527
589
  },
528
590
  emits: ["update:modelValue"],
529
591
  setup(e, { emit: t }) {
530
- let n = e, r = t, a = g(null), o = null, s = (e) => me.create({
592
+ let n = e, r = t, a = g(null), o = null, s = (e) => he.create({
531
593
  doc: e,
532
594
  extensions: [
533
- ee(),
534
- J.lineWrapping,
535
- ge,
536
- he(),
537
- J.editable.of(!n.readonly),
538
- J.updateListener.of((e) => {
595
+ te(),
596
+ Y.lineWrapping,
597
+ _e,
598
+ ge(),
599
+ Y.editable.of(!n.readonly),
600
+ Y.updateListener.of((e) => {
539
601
  e.docChanged && r("update:modelValue", e.state.doc.toString());
540
602
  })
541
603
  ]
542
604
  });
543
605
  return p(() => {
544
- a.value && (o = new J({
606
+ a.value && (o = new Y({
545
607
  state: s(n.modelValue),
546
608
  parent: a.value
547
609
  }));
@@ -555,14 +617,19 @@ var Y = Symbol("kun-editor-context"), _e = [
555
617
  class: "kun-editor__source"
556
618
  }, null, 512));
557
619
  }
558
- }), Qe = ["data-mode"], $e = {
620
+ }), rt = ["data-mode"], it = {
621
+ key: 0,
559
622
  class: "kun-editor__toolbar",
560
623
  role: "tablist"
561
- }, et = ["aria-selected", "data-active"], tt = ["aria-selected", "data-active"], nt = ["aria-selected", "data-active"], rt = ["title", "aria-label"], it = [
624
+ }, at = [
625
+ "aria-selected",
626
+ "data-active",
627
+ "onClick"
628
+ ], ot = ["title", "aria-label"], st = [
562
629
  "data-active",
563
630
  "title",
564
631
  "aria-pressed"
565
- ], at = ["data-swap"], ot = { class: "kun-editor__wysiwyg kun-editor__pane" }, st = /* @__PURE__ */ s({
632
+ ], ct = ["data-swap"], lt = { class: "kun-editor__wysiwyg kun-editor__pane" }, ut = /* @__PURE__ */ s({
566
633
  __name: "KunEditor",
567
634
  props: {
568
635
  modelValue: {},
@@ -574,36 +641,49 @@ var Y = Symbol("kun-editor-context"), _e = [
574
641
  default: !1
575
642
  },
576
643
  placeholder: { default: "" },
644
+ views: { default: () => [
645
+ "wysiwyg",
646
+ "source",
647
+ "split"
648
+ ] },
577
649
  scrollSync: {
578
650
  type: Boolean,
579
651
  default: !0
652
+ },
653
+ selectionToolbar: {
654
+ type: Boolean,
655
+ default: !0
580
656
  }
581
657
  },
582
658
  emits: ["update:modelValue"],
583
659
  setup(s, { expose: l, emit: p }) {
584
- let _ = s, T = p;
585
- h(Y, {
660
+ let T = s, E = p;
661
+ h(X, {
586
662
  get adapters() {
587
- return _.adapters;
663
+ return T.adapters;
588
664
  },
589
665
  get features() {
590
- return _.features;
666
+ return T.features;
591
667
  },
592
668
  get locale() {
593
- return _.locale;
669
+ return T.locale;
594
670
  }
595
671
  });
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;
672
+ let O = g(T.views.includes("wysiwyg") ? "wysiwyg" : T.views[0] ?? "wysiwyg"), k = (e) => {
673
+ O.value = e;
674
+ };
675
+ S(() => T.views, (e) => {
676
+ e.includes(O.value) || (O.value = e[0] ?? "wysiwyg");
603
677
  });
604
- let N = () => {
605
- M.value = !M.value;
606
- }, P = t(() => _.locale.toLowerCase().startsWith("en")), F = t(() => P.value ? {
678
+ let j = g(!1), M = () => {
679
+ j.value = !j.value;
680
+ }, N = g(T.scrollSync);
681
+ S(() => T.scrollSync, (e) => {
682
+ N.value = e;
683
+ });
684
+ let P = () => {
685
+ N.value = !N.value;
686
+ }, F = t(() => T.locale.toLowerCase().startsWith("en")), I = t(() => F.value ? {
607
687
  wysiwyg: "Preview",
608
688
  source: "Markdown",
609
689
  split: "Split",
@@ -615,123 +695,110 @@ var Y = Symbol("kun-editor-context"), _e = [
615
695
  split: "分栏",
616
696
  swap: "左右互换",
617
697
  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;
698
+ }), L = g(null), R = null, z = null, B = null, V = () => {
699
+ R?.(), R = null, z = null;
700
+ }, H = () => {
701
+ V();
702
+ let e = L.value;
623
703
  if (!e) return;
624
704
  let t = e.querySelector(".cm-scroller"), n = e.querySelector(".kun-editor__wysiwyg");
625
705
  if (!t || !n) return;
626
706
  let r = (e, t) => () => {
627
- if (R && R !== e) return;
628
- R = e;
707
+ if (z && z !== e) return;
708
+ z = e;
629
709
  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;
710
+ t.scrollTop = r * (i > 0 ? i : 0), B && clearTimeout(B), B = setTimeout(() => {
711
+ z = null;
632
712
  }, 120);
633
713
  }, i = r(t, n), a = r(n, t);
634
- t.addEventListener("scroll", i, { passive: !0 }), n.addEventListener("scroll", a, { passive: !0 }), L = () => {
714
+ t.addEventListener("scroll", i, { passive: !0 }), n.addEventListener("scroll", a, { passive: !0 }), R = () => {
635
715
  t.removeEventListener("scroll", i), n.removeEventListener("scroll", a);
636
716
  };
637
717
  };
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);
718
+ S([O, N], ([e, t]) => {
719
+ V(), e === "split" && t && u(H);
720
+ }), f(V);
721
+ let U = t(() => T.readonly || O.value === "split"), W = (e) => E("update:modelValue", e), G = g(null);
642
722
  return l({
643
- insertQuote: (e) => W.value?.insertQuote(e),
644
- insertMention: (e) => W.value?.insertMention(e),
645
- focus: () => W.value?.focus()
723
+ insertQuote: (e) => G.value?.insertQuote(e),
724
+ insertMention: (e) => G.value?.insertMention(e),
725
+ focus: () => G.value?.focus()
646
726
  }), (t, l) => (m(), i("div", {
647
727
  ref_key: "rootEl",
648
- ref: I,
728
+ ref: L,
649
729
  class: "kun-editor",
650
730
  "data-kun-editor": "",
651
- "data-mode": E.value
731
+ "data-mode": O.value
652
732
  }, [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", {
669
- type: "button",
670
- class: "kun-editor__tab",
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", {
676
- type: "button",
677
- class: "kun-editor__tab",
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, {
733
+ mode: O.value,
734
+ setMode: k,
735
+ labels: I.value,
736
+ views: s.views,
737
+ swapped: j.value,
738
+ swap: M,
739
+ scrollSync: N.value,
740
+ toggleScrollSync: P
741
+ }, () => [s.views.length > 1 ? (m(), i("div", it, [(m(!0), i(e, null, _(s.views, (e) => (m(), i("button", {
742
+ key: e,
743
+ type: "button",
744
+ class: "kun-editor__tab",
745
+ "aria-selected": O.value === e,
746
+ "data-active": O.value === e,
747
+ onClick: (t) => k(e)
748
+ }, y(I.value[e]), 9, at))), 128)), O.value === "split" ? (m(), i(e, { key: 0 }, [a("button", {
749
+ type: "button",
750
+ class: "kun-editor__tab kun-editor__swap",
751
+ title: I.value.swap,
752
+ "aria-label": I.value.swap,
753
+ onClick: l[0] ||= (e) => M()
754
+ }, " ⇄ ", 8, ot), a("button", {
755
+ type: "button",
756
+ class: "kun-editor__tab",
757
+ "data-active": N.value,
758
+ title: I.value.scrollSync,
759
+ "aria-pressed": N.value,
760
+ onClick: l[1] ||= (e) => P()
761
+ }, y(I.value.scrollSync), 9, st)], 64)) : r("", !0)])) : r("", !0)]), o(b(D), null, {
697
762
  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)])]),
763
+ default: C(() => [w(a("div", null, [o(tt, null, {
764
+ default: C((e) => [v(t.$slots, "toolbar", d(c(e)), () => [o(et)])]),
700
765
  _: 3
701
- })], 512), [[x, E.value === "wysiwyg" && !s.readonly]]), a("div", {
766
+ })], 512), [[x, O.value === "wysiwyg" && !s.readonly]]), a("div", {
702
767
  class: "kun-editor__panes",
703
- "data-swap": k.value
704
- }, [E.value === "source" || E.value === "split" ? (m(), n(Ze, {
768
+ "data-swap": j.value
769
+ }, [O.value === "source" || O.value === "split" ? (m(), n(nt, {
705
770
  key: 0,
706
771
  class: "kun-editor__pane",
707
772
  "model-value": s.modelValue,
708
773
  readonly: s.readonly,
709
- "onUpdate:modelValue": U
710
- }, null, 8, ["model-value", "readonly"])) : r("", !0), w(a("div", ot, [o(Te, {
774
+ "onUpdate:modelValue": W
775
+ }, null, 8, ["model-value", "readonly"])) : r("", !0), w(a("div", lt, [o(ke, {
711
776
  ref_key: "inner",
712
- ref: W,
777
+ ref: G,
713
778
  "model-value": s.modelValue,
714
779
  adapters: s.adapters,
715
780
  features: s.features,
716
781
  locale: s.locale,
717
- readonly: H.value,
782
+ readonly: U.value,
718
783
  placeholder: s.placeholder,
719
- "onUpdate:modelValue": U
784
+ "selection-toolbar": s.selectionToolbar,
785
+ "onUpdate:modelValue": W
720
786
  }, null, 8, [
721
787
  "model-value",
722
788
  "adapters",
723
789
  "features",
724
790
  "locale",
725
791
  "readonly",
726
- "placeholder"
727
- ])], 512), [[x, E.value === "wysiwyg" || E.value === "split"]])], 8, at)]),
792
+ "placeholder",
793
+ "selection-toolbar"
794
+ ])], 512), [[x, O.value === "wysiwyg" || O.value === "split"]])], 8, ct)]),
728
795
  _: 3
729
796
  })]),
730
797
  _: 3
731
- })], 8, Qe));
798
+ })], 8, rt));
732
799
  }
733
- }), ct = { install(e) {
734
- e.component("KunEditor", st);
800
+ }), dt = { install(e) {
801
+ e.component("KunEditor", ut);
735
802
  } };
736
803
  //#endregion
737
- export { $ as EMOJI, st as KunEditor, ct as KunEditorPlugin };
804
+ export { Ae as EMOJI, ut as KunEditor, dt as KunEditorPlugin };
package/dist/types.d.ts CHANGED
@@ -36,6 +36,8 @@ export interface KunEditorViewSwitchApi {
36
36
  mode: 'wysiwyg' | 'source' | 'split';
37
37
  /** Switch the active view. */
38
38
  setMode: (mode: 'wysiwyg' | 'source' | 'split') => void;
39
+ /** The view modes offered (from the `views` prop) — render tabs for these. */
40
+ views: ('wysiwyg' | 'source' | 'split')[];
39
41
  /** Localized labels (respects the `locale` prop). */
40
42
  labels: {
41
43
  wysiwyg: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAK5B,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,aAAa,GACb,OAAO,GACP,WAAW,GACX,IAAI,GACJ,SAAS,GACT,OAAO,GACP,QAAQ,GACR,GAAG,CAAA;AAMP,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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CAAgC;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.21.0",
3
+ "version": "0.23.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.21.0"
43
+ "@kungal/editor-core": "0.23.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.21.0"
83
+ "@kungal/editor-core": "0.23.0"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "vite build && vue-tsc -p tsconfig.build.json",