@kungal/editor-vue 0.34.0 → 0.36.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 +81 -0
- package/dist/active-marks.d.ts.map +1 -1
- package/dist/components/KunEditor.vue.d.ts.map +1 -1
- package/dist/components/LinkInput.vue.d.ts.map +1 -1
- package/dist/components/SelectionTooltip.vue.d.ts.map +1 -1
- package/dist/components/ToolbarHost.vue.d.ts.map +1 -1
- package/dist/index.js +95 -85
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# @kungal/editor-vue
|
|
2
2
|
|
|
3
|
+
## 0.36.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f7c65c2: fix(editor): the spoiler toolbar button hides the selection instead of deleting it
|
|
8
|
+
|
|
9
|
+
`insertKunSpoilerCommand` built an EMPTY `kun-spoiler` node and dropped it over
|
|
10
|
+
the selection with `replaceSelectionWith`, so clicking 隐藏文本 with text selected
|
|
11
|
+
deleted the text and left a bare `||||` — and the next thing typed landed
|
|
12
|
+
outside the node, so nothing was hidden either. The JSDoc said "wraps the
|
|
13
|
+
current selection"; the code never wrapped anything.
|
|
14
|
+
|
|
15
|
+
The command now covers the three cases the `||…||` syntax does:
|
|
16
|
+
|
|
17
|
+
- **a selection** → its text moves inside the node. The schema is `marks: ''`
|
|
18
|
+
(inline formatting cannot round-trip through `||…||`), so bold is what's
|
|
19
|
+
dropped, never the words. Selections spanning paragraphs collapse into one
|
|
20
|
+
spoiler; select-all (an `AllSelection`) works too.
|
|
21
|
+
- **an empty selection** → a new spoiler with the caret INSIDE it: type and it
|
|
22
|
+
is hidden. It holds a zero-width caret anchor, because a caret cannot sit in
|
|
23
|
+
an inline node with no text node in it — the serializer strips anchors, and a
|
|
24
|
+
spoiler holding nothing else serializes to nothing, so a stray click cannot
|
|
25
|
+
leave `||||` behind.
|
|
26
|
+
- **the caret already inside a spoiler** → reveal it, leaving the text selected.
|
|
27
|
+
Nesting would have produced `||||text||||`, which reads back as nothing.
|
|
28
|
+
|
|
29
|
+
The button is therefore a toggle, and both toolbars (the headless one and the
|
|
30
|
+
KunUI one in `@kungal/editor-nuxt`) now show it pressed while the caret is
|
|
31
|
+
inside a spoiler — `KunToggleMark` gains a `'spoiler'` member for that, so
|
|
32
|
+
`activeMarks` carries one more key.
|
|
33
|
+
|
|
34
|
+
It returns `false` — no document change — inside a code block and with a node
|
|
35
|
+
selected (an image is not text; replacing it would delete it).
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [f7c65c2]
|
|
40
|
+
- @kungal/editor-core@0.36.0
|
|
41
|
+
|
|
42
|
+
## 0.35.0
|
|
43
|
+
|
|
44
|
+
### Minor Changes
|
|
45
|
+
|
|
46
|
+
- c90e1b9: fix(link): give a typed URL the scheme it needs, in ONE place
|
|
47
|
+
|
|
48
|
+
Typing `www.kungal.com/topic/1` into any link input produced a **relative**
|
|
49
|
+
href: with no scheme the browser resolves it against the current page, so the
|
|
50
|
+
link went to `<origin>/<current/path>/www.kungal.com/topic/1` — dead, and dead
|
|
51
|
+
in a way the author can't see while writing.
|
|
52
|
+
|
|
53
|
+
`insertLinkCommand` now normalizes its `href`, and since every link entry point
|
|
54
|
+
(the selection bubble's input, the headless toolbar's URL panel, the KunUI
|
|
55
|
+
toolbar's popover, and a host's own `linkPrompt` adapter) dispatches that one
|
|
56
|
+
command, all of them are fixed at once — a host must not re-implement this.
|
|
57
|
+
|
|
58
|
+
- `www.kungal.com/topic/1` → `https://www.kungal.com/topic/1` (https, not http:
|
|
59
|
+
an http-only site redirects, an https-only site doesn't). Ports, queries,
|
|
60
|
+
fragments and bare IPv4 hosts included.
|
|
61
|
+
- `me@kungal.com` → `mailto:me@kungal.com` (`https://` would read the address as
|
|
62
|
+
userinfo and go nowhere).
|
|
63
|
+
- Untouched: anything with a scheme — `kungal-user:` / `kungal-reply:` included
|
|
64
|
+
— and anything explicitly relative (`/x`, `./x`, `../x`, `#x`, `?x`, `//host`).
|
|
65
|
+
- The one ambiguous input is a lone dotted word: `readme.md` looks exactly like
|
|
66
|
+
a hostname (`.md` is a TLD), so it gets `https://`. Write `./readme.md` when a
|
|
67
|
+
relative file is what you mean.
|
|
68
|
+
|
|
69
|
+
The rule is also exported as `normalizeLinkHref(input)` from the light,
|
|
70
|
+
zero-dependency `@kungal/editor-core` entry, so a server can normalize legacy
|
|
71
|
+
content with the exact same logic.
|
|
72
|
+
|
|
73
|
+
Along with it, the three URL inputs move from `type="url"` to `type="text"` +
|
|
74
|
+
`inputmode="url"`. Native URL validation rejects exactly the schemeless input
|
|
75
|
+
this change exists to accept — in the KunUI toolbar's popover, which submits a
|
|
76
|
+
real `<form>`, pressing Enter on `www.kungal.com/topic/1` did nothing at all.
|
|
77
|
+
The mobile keyboard hint is kept.
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [c90e1b9]
|
|
82
|
+
- @kungal/editor-core@0.35.0
|
|
83
|
+
|
|
3
84
|
## 0.34.0
|
|
4
85
|
|
|
5
86
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-marks.d.ts","sourceRoot":"","sources":["../src/active-marks.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAO5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,eAAO,MAAM,YAAY,+CAAgD,CAAA;AASzE,eAAO,MAAM,sBAAsB,QAAO,MAAM,CAAC,aAAa,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"active-marks.d.ts","sourceRoot":"","sources":["../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AAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAAA;CAChD,CAAC;AAqfJ,QAAA,IAAI,OAAO;;iBAzZS,QAAQ;;;;;;;;;;;;;CAyZP,EAAE,QAAQ;iEA7jB/B,CA9XuB;;;;;;WA8XvB,CAvWkD;aAuWlD,CAvWkE;;;;YAuWlE,CAlW8B;;;;;;;;;;;;;;CA+5BY,EAA4C,QAAQ,IAAY,CAAE;AAC5G,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,GAC7C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAShD,QAAA,MAAM,UAAU;;;;;;;;;iBAzhBE,MAAM;cART,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;qBAQA,KAAK,GAAG,OAAO;sBAgBd,OAAO,GAAG,gBAAgB,EAAE;WAVvC,QAAQ,EAAE;gBAGL,OAAO;6EA+gBtB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkInput.vue.d.ts","sourceRoot":"","sources":["../../src/components/LinkInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LinkInput.vue.d.ts","sourceRoot":"","sources":["../../src/components/LinkInput.vue"],"names":[],"mappings":"AA8UA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionTooltip.vue.d.ts","sourceRoot":"","sources":["../../src/components/SelectionTooltip.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectionTooltip.vue.d.ts","sourceRoot":"","sources":["../../src/components/SelectionTooltip.vue"],"names":[],"mappings":"AAukBA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"AA6GA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AA2GhD,QAAA,IAAI,OAAO;oCA5GX,
|
|
1
|
+
{"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"AA6GA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AA2GhD,QAAA,IAAI,OAAO;oCA5GX,CA9DI;;;;;;WA8DJ,CATK;aACG,CAAC;;;;YAC+E,CAAC;;;;;;;;;;;;;;CAmHnE,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU,+QACd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -30,39 +30,46 @@ var Ne = [
|
|
|
30
30
|
bold: !1,
|
|
31
31
|
italic: !1,
|
|
32
32
|
strike: !1,
|
|
33
|
-
code: !1
|
|
34
|
-
|
|
33
|
+
code: !1,
|
|
34
|
+
spoiler: !1
|
|
35
|
+
}), Ie = Object.freeze(Fe()), Le = (e) => {
|
|
36
|
+
let t = e.schema.nodes["kun-spoiler"];
|
|
37
|
+
if (!t) return !1;
|
|
38
|
+
let { $from: n } = e.selection;
|
|
39
|
+
for (let e = n.depth; e > 0; e--) if (n.node(e).type === t) return !0;
|
|
40
|
+
return !1;
|
|
41
|
+
}, Re = (e, t) => {
|
|
35
42
|
let { from: n, $from: r, to: i, empty: a } = e.selection, o = Fe();
|
|
36
43
|
for (let s of Ne) {
|
|
37
44
|
let c = Pe[s].type(t);
|
|
38
45
|
o[s] = a ? !!c.isInSet(e.storedMarks ?? r.marks()) : e.doc.rangeHasMark(n, i, c);
|
|
39
46
|
}
|
|
40
|
-
return o;
|
|
41
|
-
},
|
|
42
|
-
let r =
|
|
43
|
-
for (let e of
|
|
44
|
-
},
|
|
45
|
-
key:
|
|
46
|
-
view: (n) => (
|
|
47
|
-
|
|
47
|
+
return o.spoiler = Le(e), o;
|
|
48
|
+
}, ze = (e, t, n) => {
|
|
49
|
+
let r = Re(e, t);
|
|
50
|
+
for (let e of Object.keys(r)) n[e] !== r[e] && (n[e] = r[e]);
|
|
51
|
+
}, Be = new oe("KUN_ACTIVE_MARKS"), Ve = (e) => U((t) => new ae({
|
|
52
|
+
key: Be,
|
|
53
|
+
view: (n) => (ze(n.state, t, e), { update(n) {
|
|
54
|
+
ze(n.state, t, e);
|
|
48
55
|
} })
|
|
49
|
-
})), X = Symbol("kun-editor-context"),
|
|
56
|
+
})), X = Symbol("kun-editor-context"), He = [
|
|
50
57
|
"data-active",
|
|
51
58
|
"onMousedown",
|
|
52
59
|
"onMouseenter"
|
|
53
|
-
],
|
|
60
|
+
], Ue = ["src", "alt"], We = {
|
|
54
61
|
key: 1,
|
|
55
62
|
class: "kun-mention-dropdown__avatar kun-mention-dropdown__avatar--fallback"
|
|
56
|
-
},
|
|
63
|
+
}, Ge = { class: "kun-mention-dropdown__name" }, Ke = {
|
|
57
64
|
key: 1,
|
|
58
65
|
class: "kun-mention-dropdown__hint"
|
|
59
|
-
},
|
|
66
|
+
}, qe = {
|
|
60
67
|
key: 2,
|
|
61
68
|
class: "kun-mention-dropdown__hint"
|
|
62
|
-
},
|
|
69
|
+
}, Je = {
|
|
63
70
|
key: 3,
|
|
64
71
|
class: "kun-mention-dropdown__hint"
|
|
65
|
-
},
|
|
72
|
+
}, Ye = /* @__PURE__ */ s({
|
|
66
73
|
__name: "MentionDropdown",
|
|
67
74
|
setup(n) {
|
|
68
75
|
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 ? {
|
|
@@ -168,9 +175,9 @@ var Ne = [
|
|
|
168
175
|
src: e.avatar,
|
|
169
176
|
alt: e.name,
|
|
170
177
|
class: "kun-mention-dropdown__avatar"
|
|
171
|
-
}, null, 8,
|
|
178
|
+
}, null, 8, Ue)) : (m(), i("span", We, b(e.name.charAt(0)), 1)), a("span", Ge, b(e.name), 1)], 40, He))), 128)) : E.value ? (m(), i("div", Ke, b(u.value.searching), 1)) : S.value ? (m(), i("div", qe, b(u.value.empty), 1)) : (m(), i("div", Je, b(u.value.prompt), 1))], 512));
|
|
172
179
|
}
|
|
173
|
-
}),
|
|
180
|
+
}), Xe = (e, t) => {
|
|
174
181
|
let n = de.type(t), { from: r, to: i } = e.selection, a = "";
|
|
175
182
|
return e.doc.nodesBetween(r, i, (e) => {
|
|
176
183
|
if (a) return !1;
|
|
@@ -197,17 +204,17 @@ var Ne = [
|
|
|
197
204
|
check: Z("<path d=\"m5 13 4 4L19 7\"/>"),
|
|
198
205
|
close: Z("<line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/>"),
|
|
199
206
|
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\"/>")
|
|
200
|
-
},
|
|
207
|
+
}, Ze = ["data-mode"], Qe = ["placeholder", "aria-label"], $e = ["title", "aria-label"], et = ["innerHTML"], tt = ["title", "aria-label"], nt = ["innerHTML"], rt = {
|
|
201
208
|
key: 0,
|
|
202
209
|
class: "kun-editor__toolbar-divider",
|
|
203
210
|
"aria-hidden": "true"
|
|
204
|
-
},
|
|
211
|
+
}, it = [
|
|
205
212
|
"title",
|
|
206
213
|
"aria-label",
|
|
207
214
|
"aria-pressed",
|
|
208
215
|
"data-active",
|
|
209
216
|
"onMousedown"
|
|
210
|
-
],
|
|
217
|
+
], at = ["innerHTML"], ot = /* @__PURE__ */ s({
|
|
211
218
|
__name: "SelectionTooltip",
|
|
212
219
|
setup(n) {
|
|
213
220
|
let { view: r, prevState: o } = ee(), [, s] = M(), c = l(X), d = c?.activeMarks ?? Ie, h = t(() => (c?.locale ?? "zh-cn").toLowerCase().startsWith("en")), g = t(() => {
|
|
@@ -228,7 +235,7 @@ var Ne = [
|
|
|
228
235
|
let e = "";
|
|
229
236
|
return s()?.action((t) => {
|
|
230
237
|
let n = r.value?.state;
|
|
231
|
-
n && (e =
|
|
238
|
+
n && (e = Xe(n, t));
|
|
232
239
|
}), e;
|
|
233
240
|
}, N = () => {
|
|
234
241
|
T.value = !1, k.value = "", r.value?.focus();
|
|
@@ -313,14 +320,15 @@ var Ne = [
|
|
|
313
320
|
ref_key: "inputRef",
|
|
314
321
|
ref: A,
|
|
315
322
|
"onUpdate:modelValue": n[0] ||= (e) => k.value = e,
|
|
316
|
-
type: "
|
|
323
|
+
type: "text",
|
|
324
|
+
inputmode: "url",
|
|
317
325
|
class: "kun-editor__link-input",
|
|
318
326
|
placeholder: g.value.linkUrl,
|
|
319
327
|
"aria-label": g.value.linkUrl,
|
|
320
328
|
spellcheck: "false",
|
|
321
329
|
autocomplete: "off",
|
|
322
330
|
onKeydown: [n[1] ||= D(O((e) => P(), ["prevent"]), ["enter"]), n[2] ||= D(O((e) => N(), ["stop", "prevent"]), ["esc"])]
|
|
323
|
-
}, null, 40,
|
|
331
|
+
}, null, 40, Qe), [[S, k.value]]),
|
|
324
332
|
a("button", {
|
|
325
333
|
type: "button",
|
|
326
334
|
class: "kun-editor__bubble-btn",
|
|
@@ -330,7 +338,7 @@ var Ne = [
|
|
|
330
338
|
}, [a("span", {
|
|
331
339
|
class: "kun-editor__icon",
|
|
332
340
|
innerHTML: x($).check
|
|
333
|
-
}, null, 8,
|
|
341
|
+
}, null, 8, et)], 40, $e),
|
|
334
342
|
a("button", {
|
|
335
343
|
type: "button",
|
|
336
344
|
class: "kun-editor__bubble-btn",
|
|
@@ -340,8 +348,8 @@ var Ne = [
|
|
|
340
348
|
}, [a("span", {
|
|
341
349
|
class: "kun-editor__icon",
|
|
342
350
|
innerHTML: x($).close
|
|
343
|
-
}, null, 8,
|
|
344
|
-
], 64)) : (m(!0), i(e, { key: 1 }, v(L.value, (t, n) => (m(), i(e, { key: n }, [t.divider ? (m(), i("span",
|
|
351
|
+
}, null, 8, nt)], 40, tt)
|
|
352
|
+
], 64)) : (m(!0), i(e, { key: 1 }, v(L.value, (t, n) => (m(), i(e, { key: n }, [t.divider ? (m(), i("span", rt)) : (m(), i("button", {
|
|
345
353
|
key: 1,
|
|
346
354
|
type: "button",
|
|
347
355
|
class: "kun-editor__bubble-btn",
|
|
@@ -353,9 +361,9 @@ var Ne = [
|
|
|
353
361
|
}, [a("span", {
|
|
354
362
|
class: "kun-editor__icon",
|
|
355
363
|
innerHTML: t.svg
|
|
356
|
-
}, null, 8,
|
|
364
|
+
}, null, 8, at)], 40, it))], 64))), 128))], 8, Ze));
|
|
357
365
|
}
|
|
358
|
-
}),
|
|
366
|
+
}), st = /* @__PURE__ */ s({
|
|
359
367
|
__name: "MilkdownEditor",
|
|
360
368
|
props: {
|
|
361
369
|
modelValue: {},
|
|
@@ -377,13 +385,13 @@ var Ne = [
|
|
|
377
385
|
}), t.update(z, (e) => ({
|
|
378
386
|
...e,
|
|
379
387
|
editable: () => !i.readonly
|
|
380
|
-
})), f && t.set(d.key, { view: u({ component:
|
|
388
|
+
})), f && t.set(d.key, { view: u({ component: Ye }) }), h && t.set(p.key, { view: u({ component: ot }) });
|
|
381
389
|
}).use(ye(i.adapters, i.features, {
|
|
382
390
|
locale: i.locale,
|
|
383
391
|
placeholder: i.placeholder,
|
|
384
392
|
placeholderMode: i.placeholderMode
|
|
385
393
|
}));
|
|
386
|
-
return f && t.use(d), h && t.use(p), c && t.use(
|
|
394
|
+
return f && t.use(d), h && t.use(p), c && t.use(Ve(c.activeMarks)), t;
|
|
387
395
|
});
|
|
388
396
|
w(g.loading, (e) => a("update:loading", e), { immediate: !0 }), w(() => i.modelValue, (e) => {
|
|
389
397
|
if (e === o) return;
|
|
@@ -440,11 +448,11 @@ var Ne = [
|
|
|
440
448
|
}
|
|
441
449
|
}), (e, t) => (m(), n(x(k)));
|
|
442
450
|
}
|
|
443
|
-
}),
|
|
451
|
+
}), ct = [
|
|
444
452
|
"title",
|
|
445
453
|
"aria-label",
|
|
446
454
|
"aria-expanded"
|
|
447
|
-
],
|
|
455
|
+
], lt = ["innerHTML"], ut = { class: "kun-editor__link-panel" }, dt = ["placeholder", "aria-label"], ft = ["title", "aria-label"], pt = ["innerHTML"], mt = /* @__PURE__ */ s({
|
|
448
456
|
__name: "LinkInput",
|
|
449
457
|
setup(e) {
|
|
450
458
|
let [, n] = M(), r = l(X), o = t(() => (r?.locale ?? "zh-cn").toLowerCase().startsWith("en")), s = t(() => {
|
|
@@ -477,7 +485,7 @@ var Ne = [
|
|
|
477
485
|
return;
|
|
478
486
|
}
|
|
479
487
|
n()?.action((e) => {
|
|
480
|
-
d.value =
|
|
488
|
+
d.value = Xe(e.get(R).state, e);
|
|
481
489
|
}), c.value = !0, await u(), g.value?.focus(), g.value?.select();
|
|
482
490
|
}, k = (e) => {
|
|
483
491
|
c.value && h.value && !h.value.contains(e.target) && y();
|
|
@@ -496,18 +504,19 @@ var Ne = [
|
|
|
496
504
|
}, [a("span", {
|
|
497
505
|
class: "kun-editor__icon",
|
|
498
506
|
innerHTML: x($).link
|
|
499
|
-
}, null, 8,
|
|
507
|
+
}, null, 8, lt)], 8, ct), E(a("div", ut, [E(a("input", {
|
|
500
508
|
ref_key: "inputRef",
|
|
501
509
|
ref: g,
|
|
502
510
|
"onUpdate:modelValue": t[0] ||= (e) => d.value = e,
|
|
503
|
-
type: "
|
|
511
|
+
type: "text",
|
|
512
|
+
inputmode: "url",
|
|
504
513
|
class: "kun-editor__link-input",
|
|
505
514
|
placeholder: s.value.linkUrl,
|
|
506
515
|
"aria-label": s.value.linkUrl,
|
|
507
516
|
spellcheck: "false",
|
|
508
517
|
autocomplete: "off",
|
|
509
518
|
onKeydown: [t[1] ||= D(O((e) => w(), ["prevent"]), ["enter"]), t[2] ||= D(O((e) => b(), ["stop", "prevent"]), ["esc"])]
|
|
510
|
-
}, null, 40,
|
|
519
|
+
}, null, 40, dt), [[S, d.value]]), a("button", {
|
|
511
520
|
type: "button",
|
|
512
521
|
class: "kun-editor__tool",
|
|
513
522
|
title: s.value.apply,
|
|
@@ -516,23 +525,23 @@ var Ne = [
|
|
|
516
525
|
}, [a("span", {
|
|
517
526
|
class: "kun-editor__icon",
|
|
518
527
|
innerHTML: x($).check
|
|
519
|
-
}, null, 8,
|
|
528
|
+
}, null, 8, pt)], 8, ft)], 512), [[C, c.value]])], 512));
|
|
520
529
|
}
|
|
521
|
-
}),
|
|
530
|
+
}), ht = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), gt = [
|
|
522
531
|
"title",
|
|
523
532
|
"aria-label",
|
|
524
533
|
"aria-expanded"
|
|
525
|
-
],
|
|
534
|
+
], _t = ["innerHTML"], vt = { class: "kun-editor__picker-panel" }, yt = {
|
|
526
535
|
key: 0,
|
|
527
536
|
class: "kun-editor__picker-tabs",
|
|
528
537
|
role: "tablist"
|
|
529
|
-
},
|
|
538
|
+
}, bt = ["data-active"], xt = ["data-active"], St = { class: "kun-editor__emoji-grid" }, Ct = ["onClick"], wt = {
|
|
530
539
|
key: 1,
|
|
531
540
|
class: "kun-editor__sticker-body"
|
|
532
|
-
},
|
|
541
|
+
}, Tt = { class: "kun-editor__pack-name" }, Et = { class: "kun-editor__sticker-grid" }, Dt = ["title", "onClick"], Ot = ["src", "alt"], kt = {
|
|
533
542
|
key: 1,
|
|
534
543
|
class: "kun-editor__picker-hint"
|
|
535
|
-
},
|
|
544
|
+
}, At = /* @__PURE__ */ s({
|
|
536
545
|
__name: "StickerPicker",
|
|
537
546
|
setup(n) {
|
|
538
547
|
let [, o] = M(), s = l(X), c = s?.adapters.stickerSource, u = !!c, d = t(() => (s?.locale ?? "zh-cn").toLowerCase().startsWith("en")), h = t(() => d.value ? {
|
|
@@ -588,28 +597,28 @@ var Ne = [
|
|
|
588
597
|
}, [a("span", {
|
|
589
598
|
class: "kun-editor__icon",
|
|
590
599
|
innerHTML: x($).smile
|
|
591
|
-
}, null, 8,
|
|
592
|
-
u ? (m(), i("div",
|
|
600
|
+
}, null, 8, _t)], 8, gt), E(a("div", vt, [
|
|
601
|
+
u ? (m(), i("div", yt, [a("button", {
|
|
593
602
|
type: "button",
|
|
594
603
|
class: "kun-editor__picker-tab",
|
|
595
604
|
"data-active": S.value === "emoji",
|
|
596
605
|
onClick: n[0] ||= (e) => S.value = "emoji"
|
|
597
|
-
}, b(h.value.emoji), 9,
|
|
606
|
+
}, b(h.value.emoji), 9, bt), a("button", {
|
|
598
607
|
type: "button",
|
|
599
608
|
class: "kun-editor__picker-tab",
|
|
600
609
|
"data-active": S.value === "sticker",
|
|
601
610
|
onClick: n[1] ||= (e) => S.value = "sticker"
|
|
602
|
-
}, b(h.value.sticker), 9,
|
|
603
|
-
E(a("div",
|
|
611
|
+
}, b(h.value.sticker), 9, xt)])) : r("", !0),
|
|
612
|
+
E(a("div", St, [(m(!0), i(e, null, v(x(ht), (e, t) => (m(), i("button", {
|
|
604
613
|
key: t,
|
|
605
614
|
type: "button",
|
|
606
615
|
class: "kun-editor__emoji",
|
|
607
616
|
onClick: (t) => j(e)
|
|
608
|
-
}, b(e), 9,
|
|
609
|
-
u ? E((m(), i("div",
|
|
617
|
+
}, b(e), 9, Ct))), 128))], 512), [[C, !u || S.value === "emoji"]]),
|
|
618
|
+
u ? E((m(), i("div", wt, [w.value.length ? (m(!0), i(e, { key: 0 }, v(w.value, (t) => (m(), i("div", {
|
|
610
619
|
key: t.name,
|
|
611
620
|
class: "kun-editor__pack"
|
|
612
|
-
}, [a("div",
|
|
621
|
+
}, [a("div", Tt, b(t.name), 1), a("div", Et, [(m(!0), i(e, null, v(t.stickers, (e, t) => (m(), i("button", {
|
|
613
622
|
key: t,
|
|
614
623
|
type: "button",
|
|
615
624
|
class: "kun-editor__sticker",
|
|
@@ -619,23 +628,23 @@ var Ne = [
|
|
|
619
628
|
src: e.src,
|
|
620
629
|
alt: e.name,
|
|
621
630
|
loading: "lazy"
|
|
622
|
-
}, null, 8,
|
|
631
|
+
}, null, 8, Ot)], 8, Dt))), 128))])]))), 128)) : (m(), i("div", kt, b(D.value ? h.value.failed : h.value.empty), 1))], 512)), [[C, S.value === "sticker"]]) : r("", !0)
|
|
623
632
|
], 512), [[C, g.value]])], 512));
|
|
624
633
|
}
|
|
625
|
-
}),
|
|
634
|
+
}), jt = {
|
|
626
635
|
class: "kun-editor__format-toolbar",
|
|
627
636
|
role: "toolbar"
|
|
628
|
-
},
|
|
637
|
+
}, Mt = ["aria-label"], Nt = {
|
|
629
638
|
value: "",
|
|
630
639
|
disabled: "",
|
|
631
640
|
selected: ""
|
|
632
|
-
},
|
|
641
|
+
}, Pt = ["value"], Ft = [
|
|
633
642
|
"title",
|
|
634
643
|
"aria-label",
|
|
635
644
|
"aria-pressed",
|
|
636
645
|
"data-active",
|
|
637
646
|
"onClick"
|
|
638
|
-
],
|
|
647
|
+
], It = ["innerHTML"], Lt = ["title", "aria-label"], Rt = ["innerHTML"], zt = /* @__PURE__ */ s({
|
|
639
648
|
__name: "EditorToolbar",
|
|
640
649
|
setup(s) {
|
|
641
650
|
let [, c] = M(), u = l(X), d = u?.activeMarks ?? Ie, f = t(() => u?.adapters.uploadImage), p = t(() => u?.features.sticker !== !1), h = t(() => (u?.locale ?? "zh-cn").toLowerCase().startsWith("en")), g = (e, t) => {
|
|
@@ -731,7 +740,8 @@ var Ne = [
|
|
|
731
740
|
[{
|
|
732
741
|
svg: $.spoiler,
|
|
733
742
|
title: y.value.spoiler,
|
|
734
|
-
run: () => g(be.key)
|
|
743
|
+
run: () => g(be.key),
|
|
744
|
+
mark: "spoiler"
|
|
735
745
|
}]
|
|
736
746
|
]), T = _(null), E = () => T.value?.click(), D = (e) => {
|
|
737
747
|
let t = e.target, n = t.files?.[0];
|
|
@@ -745,19 +755,19 @@ var Ne = [
|
|
|
745
755
|
});
|
|
746
756
|
});
|
|
747
757
|
};
|
|
748
|
-
return (t, s) => (m(), i("div",
|
|
758
|
+
return (t, s) => (m(), i("div", jt, [
|
|
749
759
|
a("select", {
|
|
750
760
|
class: "kun-editor__heading-select",
|
|
751
761
|
"aria-label": y.value.textSize,
|
|
752
762
|
onChange: C
|
|
753
|
-
}, [a("option",
|
|
763
|
+
}, [a("option", Nt, b(y.value.textSize), 1), (m(!0), i(e, null, v(S.value, (e) => (m(), i("option", {
|
|
754
764
|
key: e.level,
|
|
755
765
|
value: e.level
|
|
756
|
-
}, b(e.label), 9,
|
|
766
|
+
}, b(e.label), 9, Pt))), 128))], 40, Mt),
|
|
757
767
|
(m(!0), i(e, null, v(w.value, (t, r) => (m(), i(e, { key: r }, [s[0] ||= a("span", {
|
|
758
768
|
class: "kun-editor__toolbar-divider",
|
|
759
769
|
"aria-hidden": "true"
|
|
760
|
-
}, null, -1), (m(!0), i(e, null, v(t, (t, r) => (m(), i(e, { key: r }, ["link" in t ? (m(), n(
|
|
770
|
+
}, null, -1), (m(!0), i(e, null, v(t, (t, r) => (m(), i(e, { key: r }, ["link" in t ? (m(), n(mt, { key: 0 })) : (m(), i("button", {
|
|
761
771
|
key: 1,
|
|
762
772
|
type: "button",
|
|
763
773
|
class: "kun-editor__tool",
|
|
@@ -769,7 +779,7 @@ var Ne = [
|
|
|
769
779
|
}, [a("span", {
|
|
770
780
|
class: "kun-editor__icon",
|
|
771
781
|
innerHTML: t.svg
|
|
772
|
-
}, null, 8,
|
|
782
|
+
}, null, 8, It)], 8, Ft))], 64))), 128))], 64))), 128)),
|
|
773
783
|
f.value ? (m(), i(e, { key: 0 }, [
|
|
774
784
|
s[1] ||= a("span", {
|
|
775
785
|
class: "kun-editor__toolbar-divider",
|
|
@@ -784,7 +794,7 @@ var Ne = [
|
|
|
784
794
|
}, [a("span", {
|
|
785
795
|
class: "kun-editor__icon",
|
|
786
796
|
innerHTML: x($).image
|
|
787
|
-
}, null, 8,
|
|
797
|
+
}, null, 8, Rt)], 8, Lt),
|
|
788
798
|
a("input", {
|
|
789
799
|
ref_key: "fileInput",
|
|
790
800
|
ref: T,
|
|
@@ -797,10 +807,10 @@ var Ne = [
|
|
|
797
807
|
p.value ? (m(), i(e, { key: 1 }, [s[2] ||= a("span", {
|
|
798
808
|
class: "kun-editor__toolbar-divider",
|
|
799
809
|
"aria-hidden": "true"
|
|
800
|
-
}, null, -1), o(
|
|
810
|
+
}, null, -1), o(At)], 64)) : r("", !0)
|
|
801
811
|
]));
|
|
802
812
|
}
|
|
803
|
-
}),
|
|
813
|
+
}), Bt = /* @__PURE__ */ s({
|
|
804
814
|
__name: "ToolbarHost",
|
|
805
815
|
setup(e) {
|
|
806
816
|
let [, t] = M(), n = l(X, void 0), r = (e, n) => {
|
|
@@ -857,7 +867,7 @@ var Ne = [
|
|
|
857
867
|
};
|
|
858
868
|
return (e, t) => y(e.$slots, "default", d(c(a)));
|
|
859
869
|
}
|
|
860
|
-
}),
|
|
870
|
+
}), Vt = /* @__PURE__ */ s({
|
|
861
871
|
__name: "MarkdownSource",
|
|
862
872
|
props: {
|
|
863
873
|
modelValue: {},
|
|
@@ -929,23 +939,23 @@ var Ne = [
|
|
|
929
939
|
class: "kun-editor__source"
|
|
930
940
|
}, null, 512));
|
|
931
941
|
}
|
|
932
|
-
}),
|
|
942
|
+
}), Ht = ["data-mode"], Ut = {
|
|
933
943
|
key: 0,
|
|
934
944
|
class: "kun-editor__toolbar",
|
|
935
945
|
role: "tablist"
|
|
936
|
-
},
|
|
946
|
+
}, Wt = [
|
|
937
947
|
"aria-selected",
|
|
938
948
|
"data-active",
|
|
939
949
|
"onClick"
|
|
940
|
-
],
|
|
950
|
+
], Gt = ["title", "aria-label"], Kt = [
|
|
941
951
|
"data-active",
|
|
942
952
|
"title",
|
|
943
953
|
"aria-pressed"
|
|
944
|
-
],
|
|
954
|
+
], qt = ["data-swap"], Jt = { class: "kun-editor__wysiwyg kun-editor__pane" }, Yt = {
|
|
945
955
|
key: 1,
|
|
946
956
|
class: "kun-editor__loading",
|
|
947
957
|
"aria-hidden": "true"
|
|
948
|
-
},
|
|
958
|
+
}, Xt = /* @__PURE__ */ s({
|
|
949
959
|
__name: "KunEditor",
|
|
950
960
|
props: {
|
|
951
961
|
modelValue: {},
|
|
@@ -1084,35 +1094,35 @@ var Ne = [
|
|
|
1084
1094
|
swap: z,
|
|
1085
1095
|
scrollSync: B.value,
|
|
1086
1096
|
toggleScrollSync: ne
|
|
1087
|
-
}, () => [s.views.length > 1 ? (m(), i("div",
|
|
1097
|
+
}, () => [s.views.length > 1 ? (m(), i("div", Ut, [(m(!0), i(e, null, v(s.views, (e) => (m(), i("button", {
|
|
1088
1098
|
key: e,
|
|
1089
1099
|
type: "button",
|
|
1090
1100
|
class: "kun-editor__tab",
|
|
1091
1101
|
"aria-selected": L.value === e,
|
|
1092
1102
|
"data-active": L.value === e,
|
|
1093
1103
|
onClick: (t) => te(e)
|
|
1094
|
-
}, b(V.value[e]), 9,
|
|
1104
|
+
}, b(V.value[e]), 9, Wt))), 128)), L.value === "split" ? (m(), i(e, { key: 0 }, [a("button", {
|
|
1095
1105
|
type: "button",
|
|
1096
1106
|
class: "kun-editor__tab kun-editor__swap",
|
|
1097
1107
|
title: V.value.swap,
|
|
1098
1108
|
"aria-label": V.value.swap,
|
|
1099
1109
|
onClick: l[0] ||= (e) => z()
|
|
1100
|
-
}, " ⇄ ", 8,
|
|
1110
|
+
}, " ⇄ ", 8, Gt), a("button", {
|
|
1101
1111
|
type: "button",
|
|
1102
1112
|
class: "kun-editor__tab",
|
|
1103
1113
|
"data-active": B.value,
|
|
1104
1114
|
title: V.value.scrollSync,
|
|
1105
1115
|
"aria-pressed": B.value,
|
|
1106
1116
|
onClick: l[1] ||= (e) => ne()
|
|
1107
|
-
}, b(V.value.scrollSync), 9,
|
|
1117
|
+
}, b(V.value.scrollSync), 9, Kt)], 64)) : r("", !0)])) : r("", !0)]), o(x(A), null, {
|
|
1108
1118
|
default: T(() => [o(x(N), null, {
|
|
1109
|
-
default: T(() => [E(a("div", null, [o(
|
|
1110
|
-
default: T((e) => [y(t.$slots, "toolbar", d(c(e)), () => [o(
|
|
1119
|
+
default: T(() => [E(a("div", null, [o(Bt, null, {
|
|
1120
|
+
default: T((e) => [y(t.$slots, "toolbar", d(c(e)), () => [o(zt)])]),
|
|
1111
1121
|
_: 3
|
|
1112
1122
|
})], 512), [[C, L.value === "wysiwyg" && !s.readonly]]), a("div", {
|
|
1113
1123
|
class: "kun-editor__panes",
|
|
1114
1124
|
"data-swap": R.value
|
|
1115
|
-
}, [L.value === "source" || L.value === "split" ? (m(), n(
|
|
1125
|
+
}, [L.value === "source" || L.value === "split" ? (m(), n(Vt, {
|
|
1116
1126
|
key: 0,
|
|
1117
1127
|
ref_key: "source",
|
|
1118
1128
|
ref: se,
|
|
@@ -1120,7 +1130,7 @@ var Ne = [
|
|
|
1120
1130
|
"model-value": s.modelValue,
|
|
1121
1131
|
readonly: s.readonly,
|
|
1122
1132
|
"onUpdate:modelValue": K
|
|
1123
|
-
}, null, 8, ["model-value", "readonly"])) : r("", !0), E(a("div",
|
|
1133
|
+
}, null, 8, ["model-value", "readonly"])) : r("", !0), E(a("div", Jt, [o(st, {
|
|
1124
1134
|
ref_key: "inner",
|
|
1125
1135
|
ref: q,
|
|
1126
1136
|
"model-value": s.modelValue,
|
|
@@ -1144,18 +1154,18 @@ var Ne = [
|
|
|
1144
1154
|
"placeholder-mode",
|
|
1145
1155
|
"active",
|
|
1146
1156
|
"selection-toolbar"
|
|
1147
|
-
])], 512), [[C, L.value === "wysiwyg" || L.value === "split"]])], 8,
|
|
1157
|
+
])], 512), [[C, L.value === "wysiwyg" || L.value === "split"]])], 8, qt)]),
|
|
1148
1158
|
_: 3
|
|
1149
1159
|
})]),
|
|
1150
1160
|
_: 3
|
|
1151
|
-
})], 64)) : r("", !0), !j.value || M.value ? (m(), i("div",
|
|
1161
|
+
})], 64)) : r("", !0), !j.value || M.value ? (m(), i("div", Yt, [y(t.$slots, "loading", {}, () => [
|
|
1152
1162
|
l[2] ||= a("div", { class: "kun-editor__skeleton" }, null, -1),
|
|
1153
1163
|
l[3] ||= a("div", { class: "kun-editor__skeleton" }, null, -1),
|
|
1154
1164
|
l[4] ||= a("div", { class: "kun-editor__skeleton" }, null, -1)
|
|
1155
|
-
])])) : r("", !0)], 8,
|
|
1165
|
+
])])) : r("", !0)], 8, Ht));
|
|
1156
1166
|
}
|
|
1157
|
-
}),
|
|
1158
|
-
e.component("KunEditor",
|
|
1167
|
+
}), Zt = { install(e) {
|
|
1168
|
+
e.component("KunEditor", Xt);
|
|
1159
1169
|
} };
|
|
1160
1170
|
//#endregion
|
|
1161
|
-
export {
|
|
1171
|
+
export { ht as EMOJI, Xt as KunEditor, Zt as KunEditorPlugin, F as parseHeadings };
|
package/dist/types.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ import type { CmdKey } from '@milkdown/kit/core';
|
|
|
2
2
|
import type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale } from '@kungal/editor-core';
|
|
3
3
|
export type KunToolbarItem = 'heading' | 'bold' | 'italic' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'quote' | 'codeBlock' | 'hr' | 'spoiler' | 'link' | 'image' | 'picker' | '|';
|
|
4
4
|
export type KunSelectionItem = 'bold' | 'italic' | 'strike' | 'code' | 'link' | '|';
|
|
5
|
-
export type KunToggleMark = 'bold' | 'italic' | 'strike' | 'code';
|
|
5
|
+
export type KunToggleMark = 'bold' | 'italic' | 'strike' | 'code' | 'spoiler';
|
|
6
6
|
export interface KunEditorToolbarApi {
|
|
7
7
|
/** Run a Milkdown command (import its key from the preset/commonmark/gfm). */
|
|
8
8
|
run: <T>(key: CmdKey<T>, payload?: T) => void;
|
|
9
9
|
/**
|
|
10
|
-
* Live toggle
|
|
11
|
-
*
|
|
10
|
+
* Live toggle state at the caret / selection (bold / italic / strike / code,
|
|
11
|
+
* and `spoiler` when the caret is inside one — its button toggles too). The
|
|
12
|
+
* same record drives the default toolbar and the selection
|
|
12
13
|
* bubble; a custom `#toolbar` reads it here. Updated on every editor view
|
|
13
14
|
* tick, including stored-mark-only toggles.
|
|
14
15
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,MAAM,GACN,OAAO,GACP,QAAQ,GACR,GAAG,CAAA;AAIP,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,GACN,GAAG,CAAA;
|
|
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,aA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GAAG,IAAI,CAAA;IAC9D,kFAAkF;IAClF,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACzE;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;IAC7B,gCAAgC;IAChC,KAAK,IAAI,IAAI,CAAA;IACb;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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.
|
|
43
|
+
"@kungal/editor-core": "0.36.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.
|
|
83
|
+
"@kungal/editor-core": "0.36.0"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "vite build && vue-tsc -p tsconfig.build.json",
|