@kungal/editor-vue 0.14.0 → 0.15.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,27 @@
1
1
  # @kungal/editor-vue
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a7273bb: Toolbar: headings become one "text size" dropdown; remove the formula button.
8
+
9
+ - **Headings → a single "text size" control** (Paragraph / H1–H6) instead of
10
+ three H1/H2/H3 buttons — the modern standard, and it can set Paragraph (reset),
11
+ which the old toggle buttons couldn't. The headless `EditorToolbar` uses a
12
+ native `<select>` (new `.kun-editor__heading-select` class hook); the KunUI
13
+ `<KunEditorToolbar>` uses a `<KunPopover>` with each level shown at its own size
14
+ (like the forum). Both drive `setHeadingCommand`.
15
+ - **Remove the math/formula button.** With no selection it inserted an empty
16
+ inline-math node (a broken formula box). Math is entered via the existing
17
+ `$…$` / `$$` input rules instead — the ecosystem norm (prosemirror-math). The
18
+ spoiler button stays.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [a7273bb]
23
+ - @kungal/editor-core@0.15.0
24
+
3
25
  ## 0.14.0
4
26
 
5
27
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"AAgZA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"AAmcA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
package/dist/index.js CHANGED
@@ -5,32 +5,32 @@ import { Editor as M, defaultValueCtx as N, editorViewCtx as P, editorViewOption
5
5
  import { listenerCtx as L } from "@milkdown/kit/plugin/listener";
6
6
  import { SlashProvider as ee, slashFactory as te } from "@milkdown/kit/plugin/slash";
7
7
  import { callCommand as R, replaceAll as z } from "@milkdown/kit/utils";
8
- import { createKunEditorPlugins as ne, insertKunSpoilerCommand as re, insertMentionCommand as B, insertQuoteCommand as V, kunCM as ie, mentionId as ae, toggleLatexCommand as oe } from "@kungal/editor-core/preset";
8
+ import { createKunEditorPlugins as ne, insertKunSpoilerCommand as re, insertMentionCommand as B, insertQuoteCommand as V, kunCM as ie, mentionId as ae, setHeadingCommand as oe } from "@kungal/editor-core/preset";
9
9
  import { TextSelection as se } from "@milkdown/kit/prose/state";
10
- import { createCodeBlockCommand as ce, insertHrCommand as le, insertImageCommand as H, toggleEmphasisCommand as U, toggleInlineCodeCommand as W, toggleStrongCommand as ue, wrapInBlockquoteCommand as de, wrapInBulletListCommand as fe, wrapInHeadingCommand as G, wrapInOrderedListCommand as pe } from "@milkdown/kit/preset/commonmark";
11
- import { toggleStrikethroughCommand as me } from "@milkdown/kit/preset/gfm";
12
- import { EditorState as he } from "@codemirror/state";
10
+ import { createCodeBlockCommand as ce, insertHrCommand as H, insertImageCommand as U, toggleEmphasisCommand as W, toggleInlineCodeCommand as G, toggleStrongCommand as le, wrapInBlockquoteCommand as ue, wrapInBulletListCommand as de, wrapInOrderedListCommand as fe } from "@milkdown/kit/preset/commonmark";
11
+ import { toggleStrikethroughCommand as pe } from "@milkdown/kit/preset/gfm";
12
+ import { EditorState as me } from "@codemirror/state";
13
13
  import { EditorView as K } from "@codemirror/view";
14
- import { markdown as ge } from "@codemirror/lang-markdown";
15
- import { basicSetup as _e } from "codemirror";
14
+ import { markdown as he } from "@codemirror/lang-markdown";
15
+ import { basicSetup as ge } from "codemirror";
16
16
  //#region src/context.ts
17
- var q = Symbol("kun-editor-context"), ve = [
17
+ var q = Symbol("kun-editor-context"), _e = [
18
18
  "data-active",
19
19
  "onMousedown",
20
20
  "onMouseenter"
21
- ], ye = ["src", "alt"], be = {
21
+ ], ve = ["src", "alt"], ye = {
22
22
  key: 1,
23
23
  class: "kun-mention-dropdown__avatar kun-mention-dropdown__avatar--fallback"
24
- }, xe = { class: "kun-mention-dropdown__name" }, Se = {
24
+ }, be = { class: "kun-mention-dropdown__name" }, xe = {
25
25
  key: 1,
26
26
  class: "kun-mention-dropdown__hint"
27
- }, Ce = {
27
+ }, Se = {
28
28
  key: 2,
29
29
  class: "kun-mention-dropdown__hint"
30
- }, we = {
30
+ }, Ce = {
31
31
  key: 3,
32
32
  class: "kun-mention-dropdown__hint"
33
- }, Te = /* @__PURE__ */ s({
33
+ }, we = /* @__PURE__ */ s({
34
34
  __name: "MentionDropdown",
35
35
  setup(n) {
36
36
  let r = /(?:^|\s)@([^\s@]{0,30})$/, o = l(q), s = o?.adapters.searchMentionUsers, c = t(() => (o?.locale ?? "zh-cn").toLowerCase().startsWith("en")), u = t(() => c.value ? {
@@ -136,9 +136,9 @@ var q = Symbol("kun-editor-context"), ve = [
136
136
  src: e.avatar,
137
137
  alt: e.name,
138
138
  class: "kun-mention-dropdown__avatar"
139
- }, null, 8, ye)) : (p(), i("span", be, v(e.name.charAt(0)), 1)), a("span", xe, v(e.name), 1)], 40, ve))), 128)) : D.value ? (p(), i("div", Se, v(u.value.searching), 1)) : C.value ? (p(), i("div", Ce, v(u.value.empty), 1)) : (p(), i("div", we, v(u.value.prompt), 1))], 512));
139
+ }, null, 8, ve)) : (p(), i("span", ye, v(e.name.charAt(0)), 1)), a("span", be, v(e.name), 1)], 40, _e))), 128)) : D.value ? (p(), i("div", xe, v(u.value.searching), 1)) : C.value ? (p(), i("div", Se, v(u.value.empty), 1)) : (p(), i("div", Ce, v(u.value.prompt), 1))], 512));
140
140
  }
141
- }), Ee = /* @__PURE__ */ s({
141
+ }), Te = /* @__PURE__ */ s({
142
142
  __name: "MilkdownEditor",
143
143
  props: {
144
144
  modelValue: {},
@@ -156,7 +156,7 @@ var q = Symbol("kun-editor-context"), ve = [
156
156
  }), t.update(F, (e) => ({
157
157
  ...e,
158
158
  editable: () => !i.readonly
159
- })), l && t.set(c.key, { view: s({ component: Te }) });
159
+ })), l && t.set(c.key, { view: s({ component: we }) });
160
160
  }).use(ne(i.adapters, i.features, { locale: i.locale }));
161
161
  return l && t.use(c), t;
162
162
  });
@@ -193,21 +193,21 @@ var q = Symbol("kun-editor-context"), ve = [
193
193
  spoiler: J("<path d=\"M9.9 4.24A9.1 9.1 0 0 1 12 4c7 0 10 8 10 8a13.2 13.2 0 0 1-1.67 2.68\"/><path d=\"M6.6 6.6A13.5 13.5 0 0 0 2 12s3 8 10 8a9.7 9.7 0 0 0 5.4-1.6\"/><line x1=\"2\" y1=\"2\" x2=\"22\" y2=\"22\"/>"),
194
194
  latex: Y("Σ", 15),
195
195
  smile: J("<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M8 14s1.5 2 4 2 4-2 4-2\"/><line x1=\"9\" y1=\"9\" x2=\"9.01\" y2=\"9\"/><line x1=\"15\" y1=\"9\" x2=\"15.01\" y2=\"9\"/>")
196
- }, Z = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), De = [
196
+ }, Z = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), Ee = [
197
197
  "title",
198
198
  "aria-label",
199
199
  "aria-expanded"
200
- ], Oe = ["innerHTML"], ke = { class: "kun-editor__picker-panel" }, Ae = {
200
+ ], De = ["innerHTML"], Oe = { class: "kun-editor__picker-panel" }, ke = {
201
201
  key: 0,
202
202
  class: "kun-editor__picker-tabs",
203
203
  role: "tablist"
204
- }, je = ["data-active"], Me = ["data-active"], Ne = { class: "kun-editor__emoji-grid" }, Pe = ["onClick"], Fe = {
204
+ }, Ae = ["data-active"], je = ["data-active"], Me = { class: "kun-editor__emoji-grid" }, Ne = ["onClick"], Pe = {
205
205
  key: 1,
206
206
  class: "kun-editor__sticker-body"
207
- }, Ie = { class: "kun-editor__pack-name" }, Le = { class: "kun-editor__sticker-grid" }, Re = ["title", "onClick"], ze = ["src", "alt"], Be = {
207
+ }, Fe = { class: "kun-editor__pack-name" }, Ie = { class: "kun-editor__sticker-grid" }, Le = ["title", "onClick"], Re = ["src", "alt"], ze = {
208
208
  key: 1,
209
209
  class: "kun-editor__picker-hint"
210
- }, Ve = /* @__PURE__ */ s({
210
+ }, Be = /* @__PURE__ */ s({
211
211
  __name: "StickerPicker",
212
212
  setup(n) {
213
213
  let [, o] = O(), s = l(q), c = s?.adapters.stickerSource, u = !!c, m = t(() => (s?.locale ?? "zh-cn").toLowerCase().startsWith("en")), _ = t(() => m.value ? {
@@ -243,7 +243,7 @@ var q = Symbol("kun-editor-context"), ve = [
243
243
  n.dispatch(r.tr.insertText(e, r.selection.from));
244
244
  });
245
245
  }, N = (e, t) => {
246
- o()?.action(R(H.key, {
246
+ o()?.action(R(U.key, {
247
247
  src: e,
248
248
  title: t,
249
249
  alt: t
@@ -263,28 +263,28 @@ var q = Symbol("kun-editor-context"), ve = [
263
263
  }, [a("span", {
264
264
  class: "kun-editor__icon",
265
265
  innerHTML: y(X).smile
266
- }, null, 8, Oe)], 8, De), C(a("div", ke, [
267
- u ? (p(), i("div", Ae, [a("button", {
266
+ }, null, 8, De)], 8, Ee), C(a("div", Oe, [
267
+ u ? (p(), i("div", ke, [a("button", {
268
268
  type: "button",
269
269
  class: "kun-editor__picker-tab",
270
270
  "data-active": w.value === "emoji",
271
271
  onClick: n[0] ||= (e) => w.value = "emoji"
272
- }, v(_.value.emoji), 9, je), a("button", {
272
+ }, v(_.value.emoji), 9, Ae), a("button", {
273
273
  type: "button",
274
274
  class: "kun-editor__picker-tab",
275
275
  "data-active": w.value === "sticker",
276
276
  onClick: n[1] ||= (e) => w.value = "sticker"
277
- }, v(_.value.sticker), 9, Me)])) : r("", !0),
278
- C(a("div", Ne, [(p(!0), i(e, null, g(y(Z), (e, t) => (p(), i("button", {
277
+ }, v(_.value.sticker), 9, je)])) : r("", !0),
278
+ C(a("div", Me, [(p(!0), i(e, null, g(y(Z), (e, t) => (p(), i("button", {
279
279
  key: t,
280
280
  type: "button",
281
281
  class: "kun-editor__emoji",
282
282
  onClick: (t) => M(e)
283
- }, v(e), 9, Pe))), 128))], 512), [[b, !u || w.value === "emoji"]]),
284
- u ? C((p(), i("div", Fe, [T.value.length ? (p(!0), i(e, { key: 0 }, g(T.value, (t) => (p(), i("div", {
283
+ }, v(e), 9, Ne))), 128))], 512), [[b, !u || w.value === "emoji"]]),
284
+ u ? C((p(), i("div", Pe, [T.value.length ? (p(!0), i(e, { key: 0 }, g(T.value, (t) => (p(), i("div", {
285
285
  key: t.name,
286
286
  class: "kun-editor__pack"
287
- }, [a("div", Ie, v(t.name), 1), a("div", Le, [(p(!0), i(e, null, g(t.stickers, (e, t) => (p(), i("button", {
287
+ }, [a("div", Fe, v(t.name), 1), a("div", Ie, [(p(!0), i(e, null, g(t.stickers, (e, t) => (p(), i("button", {
288
288
  key: t,
289
289
  type: "button",
290
290
  class: "kun-editor__sticker",
@@ -294,127 +294,120 @@ var q = Symbol("kun-editor-context"), ve = [
294
294
  src: e.src,
295
295
  alt: e.name,
296
296
  loading: "lazy"
297
- }, null, 8, ze)], 8, Re))), 128))])]))), 128)) : (p(), i("div", Be, v(D.value ? _.value.failed : _.value.empty), 1))], 512)), [[b, w.value === "sticker"]]) : r("", !0)
297
+ }, null, 8, Re)], 8, Le))), 128))])]))), 128)) : (p(), i("div", ze, v(D.value ? _.value.failed : _.value.empty), 1))], 512)), [[b, w.value === "sticker"]]) : r("", !0)
298
298
  ], 512), [[b, x.value]])], 512));
299
299
  }
300
- }), He = {
300
+ }), Ve = {
301
301
  class: "kun-editor__format-toolbar",
302
302
  role: "toolbar"
303
- }, Q = {
304
- key: 0,
305
- class: "kun-editor__toolbar-divider",
306
- "aria-hidden": "true"
307
- }, Ue = [
303
+ }, He = ["aria-label"], Q = {
304
+ value: "",
305
+ disabled: "",
306
+ selected: ""
307
+ }, Ue = ["value"], We = [
308
308
  "title",
309
309
  "aria-label",
310
310
  "onClick"
311
- ], We = ["innerHTML"], Ge = ["title", "aria-label"], Ke = ["innerHTML"], qe = /* @__PURE__ */ s({
311
+ ], Ge = ["innerHTML"], Ke = ["title", "aria-label"], qe = ["innerHTML"], Je = /* @__PURE__ */ s({
312
312
  __name: "EditorToolbar",
313
313
  setup(n) {
314
314
  let [, s] = O(), c = l(q), u = t(() => c?.adapters.uploadImage), d = () => c?.adapters.notify, f = t(() => c?.features.sticker !== !1), m = t(() => (c?.locale ?? "zh-cn").toLowerCase().startsWith("en")), _ = (e, t) => {
315
315
  s()?.action(R(e, t));
316
- }, v = t(() => {
316
+ }, b = t(() => {
317
317
  let e = m.value;
318
318
  return {
319
+ textSize: e ? "Text size" : "文本大小",
319
320
  bold: e ? "Bold" : "加粗",
320
321
  italic: e ? "Italic" : "斜体",
321
322
  strike: e ? "Strikethrough" : "删除线",
322
323
  code: e ? "Inline code" : "行内代码",
323
- h1: e ? "Heading 1" : "一级标题",
324
- h2: e ? "Heading 2" : "二级标题",
325
- h3: e ? "Heading 3" : "三级标题",
326
324
  bulletList: e ? "Bullet list" : "无序列表",
327
325
  orderedList: e ? "Ordered list" : "有序列表",
328
326
  quote: e ? "Blockquote" : "引用块",
329
327
  codeBlock: e ? "Code block" : "代码块",
330
328
  hr: e ? "Divider" : "分隔线",
331
329
  spoiler: e ? "Spoiler" : "隐藏文本",
332
- latex: e ? "Math (LaTeX)" : "公式",
333
330
  image: e ? "Upload image" : "上传图片"
334
331
  };
335
- }), b = t(() => [
332
+ }), x = t(() => {
333
+ let e = m.value;
334
+ return [
335
+ "正文",
336
+ "一级标题",
337
+ "二级标题",
338
+ "三级标题",
339
+ "四级标题",
340
+ "五级标题",
341
+ "六级标题"
342
+ ].map((t, n) => ({
343
+ level: n,
344
+ label: e ? n === 0 ? "Paragraph" : `Heading ${n}` : t
345
+ }));
346
+ }), S = (e) => {
347
+ let t = e.target;
348
+ _(oe.key, Number(t.value)), t.selectedIndex = 0;
349
+ }, C = t(() => [
336
350
  [
337
351
  {
338
352
  svg: X.bold,
339
- title: v.value.bold,
340
- run: () => _(ue.key)
353
+ title: b.value.bold,
354
+ run: () => _(le.key)
341
355
  },
342
356
  {
343
357
  svg: X.italic,
344
- title: v.value.italic,
345
- run: () => _(U.key)
358
+ title: b.value.italic,
359
+ run: () => _(W.key)
346
360
  },
347
361
  {
348
362
  svg: X.strike,
349
- title: v.value.strike,
350
- run: () => _(me.key)
363
+ title: b.value.strike,
364
+ run: () => _(pe.key)
351
365
  },
352
366
  {
353
367
  svg: X.code,
354
- title: v.value.code,
355
- run: () => _(W.key)
356
- }
357
- ],
358
- [
359
- {
360
- svg: X.h1,
361
- title: v.value.h1,
362
- run: () => _(G.key, 1)
363
- },
364
- {
365
- svg: X.h2,
366
- title: v.value.h2,
367
- run: () => _(G.key, 2)
368
- },
369
- {
370
- svg: X.h3,
371
- title: v.value.h3,
372
- run: () => _(G.key, 3)
368
+ title: b.value.code,
369
+ run: () => _(G.key)
373
370
  }
374
371
  ],
375
372
  [
376
373
  {
377
374
  svg: X.bulletList,
378
- title: v.value.bulletList,
379
- run: () => _(fe.key)
375
+ title: b.value.bulletList,
376
+ run: () => _(de.key)
380
377
  },
381
378
  {
382
379
  svg: X.orderedList,
383
- title: v.value.orderedList,
384
- run: () => _(pe.key)
380
+ title: b.value.orderedList,
381
+ run: () => _(fe.key)
385
382
  },
386
383
  {
387
384
  svg: X.quote,
388
- title: v.value.quote,
389
- run: () => _(de.key)
385
+ title: b.value.quote,
386
+ run: () => _(ue.key)
390
387
  },
391
388
  {
392
389
  svg: X.codeBlock,
393
- title: v.value.codeBlock,
390
+ title: b.value.codeBlock,
394
391
  run: () => _(ce.key, "")
395
392
  },
396
393
  {
397
394
  svg: X.hr,
398
- title: v.value.hr,
399
- run: () => _(le.key)
395
+ title: b.value.hr,
396
+ run: () => _(H.key)
400
397
  }
401
398
  ],
402
399
  [{
403
400
  svg: X.spoiler,
404
- title: v.value.spoiler,
401
+ title: b.value.spoiler,
405
402
  run: () => _(re.key)
406
- }, {
407
- svg: X.latex,
408
- title: v.value.latex,
409
- run: () => _(oe.key)
410
403
  }]
411
- ]), x = h(null), S = () => x.value?.click(), C = async (e) => {
404
+ ]), w = h(null), T = () => w.value?.click(), E = async (e) => {
412
405
  let t = e.target, n = t.files?.[0];
413
406
  t.value = "";
414
407
  let r = u.value;
415
408
  if (!(!n || !r)) try {
416
409
  let e = await r(n);
417
- _(H.key, {
410
+ _(U.key, {
418
411
  src: e,
419
412
  title: n.name,
420
413
  alt: n.name
@@ -423,8 +416,19 @@ var q = Symbol("kun-editor-context"), ve = [
423
416
  d()?.(m.value ? "Image upload failed" : "图片上传失败", "error");
424
417
  }
425
418
  };
426
- return (t, n) => (p(), i("div", He, [
427
- (p(!0), i(e, null, g(b.value, (t, n) => (p(), i(e, { key: n }, [n > 0 ? (p(), i("span", Q)) : r("", !0), (p(!0), i(e, null, g(t, (e, t) => (p(), i("button", {
419
+ return (t, n) => (p(), i("div", Ve, [
420
+ a("select", {
421
+ class: "kun-editor__heading-select",
422
+ "aria-label": b.value.textSize,
423
+ onChange: S
424
+ }, [a("option", Q, v(b.value.textSize), 1), (p(!0), i(e, null, g(x.value, (e) => (p(), i("option", {
425
+ key: e.level,
426
+ value: e.level
427
+ }, v(e.label), 9, Ue))), 128))], 40, He),
428
+ (p(!0), i(e, null, g(C.value, (t, r) => (p(), i(e, { key: r }, [n[0] ||= a("span", {
429
+ class: "kun-editor__toolbar-divider",
430
+ "aria-hidden": "true"
431
+ }, null, -1), (p(!0), i(e, null, g(t, (e, t) => (p(), i("button", {
428
432
  key: t,
429
433
  type: "button",
430
434
  class: "kun-editor__tool",
@@ -434,38 +438,38 @@ var q = Symbol("kun-editor-context"), ve = [
434
438
  }, [a("span", {
435
439
  class: "kun-editor__icon",
436
440
  innerHTML: e.svg
437
- }, null, 8, We)], 8, Ue))), 128))], 64))), 128)),
441
+ }, null, 8, Ge)], 8, We))), 128))], 64))), 128)),
438
442
  u.value ? (p(), i(e, { key: 0 }, [
439
- n[0] ||= a("span", {
443
+ n[1] ||= a("span", {
440
444
  class: "kun-editor__toolbar-divider",
441
445
  "aria-hidden": "true"
442
446
  }, null, -1),
443
447
  a("button", {
444
448
  type: "button",
445
449
  class: "kun-editor__tool",
446
- title: v.value.image,
447
- "aria-label": v.value.image,
448
- onClick: S
450
+ title: b.value.image,
451
+ "aria-label": b.value.image,
452
+ onClick: T
449
453
  }, [a("span", {
450
454
  class: "kun-editor__icon",
451
455
  innerHTML: y(X).image
452
- }, null, 8, Ke)], 8, Ge),
456
+ }, null, 8, qe)], 8, Ke),
453
457
  a("input", {
454
458
  ref_key: "fileInput",
455
- ref: x,
459
+ ref: w,
456
460
  type: "file",
457
461
  accept: ".jpg,.jpeg,.png,.webp,.gif",
458
462
  hidden: "",
459
- onChange: C
463
+ onChange: E
460
464
  }, null, 544)
461
465
  ], 64)) : r("", !0),
462
- f.value ? (p(), i(e, { key: 1 }, [n[1] ||= a("span", {
466
+ f.value ? (p(), i(e, { key: 1 }, [n[2] ||= a("span", {
463
467
  class: "kun-editor__toolbar-divider",
464
468
  "aria-hidden": "true"
465
- }, null, -1), o(Ve)], 64)) : r("", !0)
469
+ }, null, -1), o(Be)], 64)) : r("", !0)
466
470
  ]));
467
471
  }
468
- }), Je = /* @__PURE__ */ s({
472
+ }), Ye = /* @__PURE__ */ s({
469
473
  __name: "ToolbarHost",
470
474
  setup(e) {
471
475
  let [, t] = O(), n = l(q, void 0), r = (e, n) => {
@@ -499,7 +503,7 @@ var q = Symbol("kun-editor-context"), ve = [
499
503
  };
500
504
  return (e, t) => _(e.$slots, "default", u(c(a)));
501
505
  }
502
- }), Ye = /* @__PURE__ */ s({
506
+ }), Xe = /* @__PURE__ */ s({
503
507
  __name: "MarkdownSource",
504
508
  props: {
505
509
  modelValue: {},
@@ -507,13 +511,13 @@ var q = Symbol("kun-editor-context"), ve = [
507
511
  },
508
512
  emits: ["update:modelValue"],
509
513
  setup(e, { emit: t }) {
510
- let n = e, r = t, a = h(null), o = null, s = (e) => he.create({
514
+ let n = e, r = t, a = h(null), o = null, s = (e) => me.create({
511
515
  doc: e,
512
516
  extensions: [
513
517
  ie(),
514
518
  K.lineWrapping,
515
- _e,
516
- ge(),
519
+ ge,
520
+ he(),
517
521
  K.editable.of(!n.readonly),
518
522
  K.updateListener.of((e) => {
519
523
  e.docChanged && r("update:modelValue", e.state.doc.toString());
@@ -535,13 +539,13 @@ var q = Symbol("kun-editor-context"), ve = [
535
539
  class: "kun-editor__source"
536
540
  }, null, 512));
537
541
  }
538
- }), Xe = {
542
+ }), Ze = {
539
543
  class: "kun-editor",
540
544
  "data-kun-editor": ""
541
- }, Ze = {
545
+ }, Qe = {
542
546
  class: "kun-editor__toolbar",
543
547
  role: "tablist"
544
- }, Qe = ["aria-selected", "data-active"], $e = ["aria-selected", "data-active"], et = { class: "kun-editor__wysiwyg" }, $ = /* @__PURE__ */ s({
548
+ }, $e = ["aria-selected", "data-active"], et = ["aria-selected", "data-active"], tt = { class: "kun-editor__wysiwyg" }, $ = /* @__PURE__ */ s({
545
549
  __name: "KunEditor",
546
550
  props: {
547
551
  modelValue: {},
@@ -580,30 +584,30 @@ var q = Symbol("kun-editor-context"), ve = [
580
584
  insertQuote: (e) => O.value?.insertQuote(e),
581
585
  insertMention: (e) => O.value?.insertMention(e),
582
586
  focus: () => O.value?.focus()
583
- }), (t, s) => (p(), i("div", Xe, [
587
+ }), (t, s) => (p(), i("div", Ze, [
584
588
  _(t.$slots, "view-switch", {
585
589
  mode: g.value,
586
590
  setMode: x,
587
591
  labels: T.value
588
- }, () => [a("div", Ze, [a("button", {
592
+ }, () => [a("div", Qe, [a("button", {
589
593
  type: "button",
590
594
  class: "kun-editor__tab",
591
595
  "aria-selected": g.value === "wysiwyg",
592
596
  "data-active": g.value === "wysiwyg",
593
597
  onClick: s[0] ||= (e) => x("wysiwyg")
594
- }, v(T.value.wysiwyg), 9, Qe), a("button", {
598
+ }, v(T.value.wysiwyg), 9, $e), a("button", {
595
599
  type: "button",
596
600
  class: "kun-editor__tab",
597
601
  "aria-selected": g.value === "source",
598
602
  "data-active": g.value === "source",
599
603
  onClick: s[1] ||= (e) => x("source")
600
- }, v(T.value.source), 9, $e)])]),
604
+ }, v(T.value.source), 9, et)])]),
601
605
  o(y(E), null, {
602
606
  default: S(() => [o(y(k), null, {
603
- default: S(() => [C(a("div", null, [o(Je, null, {
604
- default: S((e) => [_(t.$slots, "toolbar", u(c(e)), () => [o(qe)])]),
607
+ default: S(() => [C(a("div", null, [o(Ye, null, {
608
+ default: S((e) => [_(t.$slots, "toolbar", u(c(e)), () => [o(Je)])]),
605
609
  _: 3
606
- })], 512), [[b, g.value === "wysiwyg" && !e.readonly]]), C(a("div", et, [o(Ee, {
610
+ })], 512), [[b, g.value === "wysiwyg" && !e.readonly]]), C(a("div", tt, [o(Te, {
607
611
  ref_key: "inner",
608
612
  ref: O,
609
613
  "model-value": e.modelValue,
@@ -623,7 +627,7 @@ var q = Symbol("kun-editor-context"), ve = [
623
627
  })]),
624
628
  _: 3
625
629
  }),
626
- g.value === "source" ? (p(), n(Ye, {
630
+ g.value === "source" ? (p(), n(Xe, {
627
631
  key: 0,
628
632
  "model-value": e.modelValue,
629
633
  readonly: e.readonly,
@@ -631,8 +635,8 @@ var q = Symbol("kun-editor-context"), ve = [
631
635
  }, null, 8, ["model-value", "readonly"])) : r("", !0)
632
636
  ]));
633
637
  }
634
- }), tt = { install(e) {
638
+ }), nt = { install(e) {
635
639
  e.component("KunEditor", $);
636
640
  } };
637
641
  //#endregion
638
- export { Z as EMOJI, $ as KunEditor, tt as KunEditorPlugin };
642
+ export { Z as EMOJI, $ as KunEditor, nt as KunEditorPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-vue",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "KunEditor Vue 3 layer — the <KunEditor> component (dual WYSIWYG / markdown-source), toolbar and plugin views. Consumes @kungal/editor-core; pairs with @kungal/ui-vue.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@prosemirror-adapter/vue": "^0.4.6",
43
- "@kungal/editor-core": "0.14.0"
43
+ "@kungal/editor-core": "0.15.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.14.0"
83
+ "@kungal/editor-core": "0.15.0"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "vite build && vue-tsc -p tsconfig.build.json",