@kungal/editor-vue 0.23.0 → 0.24.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 +31 -0
- package/dist/components/KunEditor.vue.d.ts +9 -4
- package/dist/components/KunEditor.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/context.d.ts +3 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +156 -131
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @kungal/editor-vue
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5c981df: The selection bubble toolbar's buttons are now configurable.
|
|
8
|
+
|
|
9
|
+
`<KunEditor>`'s `selectionToolbar` prop now accepts `boolean | KunSelectionItem[]`:
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<KunEditor v-model="md" />
|
|
13
|
+
<!-- default 4 buttons -->
|
|
14
|
+
<KunEditor v-model="md" :selection-toolbar="['bold', 'italic']" />
|
|
15
|
+
<!-- reorder / subset -->
|
|
16
|
+
<KunEditor v-model="md" :selection-toolbar="false" />
|
|
17
|
+
<!-- off -->
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`KunSelectionItem` is `'bold' | 'italic' | 'strike' | 'code' | '|'` (`'|'` a
|
|
21
|
+
divider), exported from `@kungal/editor-vue`. The resolved items reach the bubble
|
|
22
|
+
(a plugin view) through the editor context; dividers collapse around removed
|
|
23
|
+
items. The bubble's **look** is (and was) styled via the `.kun-editor__bubble` /
|
|
24
|
+
`.kun-editor__bubble-btn` class hooks — headless, no new API.
|
|
25
|
+
|
|
26
|
+
Verified in the docs production build: an editor with
|
|
27
|
+
`:selection-toolbar="['bold','italic']"` shows a 2-button bubble while the default
|
|
28
|
+
shows 4; 0 console errors.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- @kungal/editor-core@0.24.0
|
|
33
|
+
|
|
3
34
|
## 0.23.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale } from '@kungal/editor-core';
|
|
2
|
-
import type { KunEditorExpose } from '../types';
|
|
2
|
+
import type { KunEditorExpose, KunSelectionItem } from '../types';
|
|
3
3
|
type ViewMode = 'wysiwyg' | 'source' | 'split';
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
/** Bound markdown (v-model). */
|
|
@@ -23,8 +23,13 @@ type __VLS_Props = {
|
|
|
23
23
|
/** Sync scrolling between the split panes. Default `true`; set `false` to
|
|
24
24
|
* disable (or toggle it at runtime via the view-switch API). */
|
|
25
25
|
scrollSync?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The floating toolbar shown on text selection. `true` (default) = the
|
|
28
|
+
* standard buttons; `false` = off; or pass an ordered `KunSelectionItem[]`
|
|
29
|
+
* to reorder / subset them (`'|'` is a divider). Its look is styled via the
|
|
30
|
+
* `.kun-editor__bubble` / `.kun-editor__bubble-btn` class hooks.
|
|
31
|
+
*/
|
|
32
|
+
selectionToolbar?: boolean | KunSelectionItem[];
|
|
28
33
|
};
|
|
29
34
|
declare var __VLS_1: {
|
|
30
35
|
mode: ViewMode;
|
|
@@ -73,7 +78,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, KunEditorEx
|
|
|
73
78
|
locale: KunEditorLocale;
|
|
74
79
|
readonly: boolean;
|
|
75
80
|
placeholder: string;
|
|
76
|
-
selectionToolbar: boolean;
|
|
81
|
+
selectionToolbar: boolean | KunSelectionItem[];
|
|
77
82
|
views: ViewMode[];
|
|
78
83
|
scrollSync: boolean;
|
|
79
84
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KunEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/KunEditor.vue"],"names":[],"mappings":"AA8VA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AASjE,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE9C,KAAK,WAAW,GAAG;IACf,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,qDAAqD;IACrD,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAA;IAClB;oEACgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAAA;CAChD,CAAC;AA0ZJ,QAAA,IAAI,OAAO;;iBAlWS,QAAQ;;;;;;;;;;;;;CAkWP,EAAE,QAAQ;iEA/c/B,CAjUkC;;;;;;;;;;;;;;;CAgxB8B,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;;;;;cA9bD,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;iBAEJ,MAAM;sBAgBD,OAAO,GAAG,gBAAgB,EAAE;WAVvC,QAAQ,EAAE;gBAGL,OAAO;6EAkbtB,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":"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":"AA2RA,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":"AAyFA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAuFhD,QAAA,IAAI,OAAO;oCAxFX,
|
|
1
|
+
{"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"AAyFA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAuFhD,QAAA,IAAI,OAAO;oCAxFX,CArDQ;;;;;;;;;;;;;;;CA6Ic,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/context.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InjectionKey } from 'vue';
|
|
2
2
|
import type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale } from '@kungal/editor-core';
|
|
3
|
+
import type { KunSelectionItem } from './types';
|
|
3
4
|
export interface KunEditorContext {
|
|
4
5
|
/** The host policy bundle (searchMentionUsers, stickerSource, notify, …). */
|
|
5
6
|
readonly adapters: KunEditorAdapters;
|
|
@@ -7,6 +8,8 @@ export interface KunEditorContext {
|
|
|
7
8
|
readonly features: KunEditorFeatures;
|
|
8
9
|
/** UI language, for view chrome (dropdown hints, picker tabs, etc.). */
|
|
9
10
|
readonly locale: KunEditorLocale;
|
|
11
|
+
/** Ordered buttons for the selection bubble toolbar (a plugin view reads it). */
|
|
12
|
+
readonly selectionToolbarItems: KunSelectionItem[];
|
|
10
13
|
}
|
|
11
14
|
export declare const KUN_EDITOR_CONTEXT: InjectionKey<KunEditorContext>;
|
|
12
15
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AACvC,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AACvC,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,iFAAiF;IACjF,QAAQ,CAAC,qBAAqB,EAAE,gBAAgB,EAAE,CAAA;CACnD;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,gBAAgB,CAChC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { KunEditor };
|
|
|
4
4
|
export type { KunEditorExpose } from './types';
|
|
5
5
|
export type { KunEditorToolbarApi } from './types';
|
|
6
6
|
export type { KunToolbarItem } from './types';
|
|
7
|
+
export type { KunSelectionItem } from './types';
|
|
7
8
|
export type { KunEditorViewSwitchApi } from './types';
|
|
8
9
|
export { EMOJI } from './emoji';
|
|
9
10
|
export type { KunEditorAdapters, KunEditorFeatures, KunEditorLocale, UploadImage, SearchMentionUsers, StickerSource, Notify, NotifyLevel, MentionUser, StickerItem, StickerPack } from '@kungal/editor-core';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,SAAS,MAAM,4BAA4B,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,CAAA;AAGpB,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAGlD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,+EAA+E;AAC/E,eAAO,MAAM,eAAe,EAAE,MAI7B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,SAAS,MAAM,4BAA4B,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,CAAA;AAGpB,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAGlD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,+EAA+E;AAC/E,eAAO,MAAM,eAAe,EAAE,MAI7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { listenerCtx as R } from "@milkdown/kit/plugin/listener";
|
|
|
6
6
|
import { SlashProvider as z, slashFactory as B } from "@milkdown/kit/plugin/slash";
|
|
7
7
|
import { TooltipProvider as V, tooltipFactory as H } from "@milkdown/kit/plugin/tooltip";
|
|
8
8
|
import { callCommand as U, replaceAll as W } from "@milkdown/kit/utils";
|
|
9
|
-
import { createKunEditorPlugins as G, insertKunSpoilerCommand as
|
|
9
|
+
import { createKunEditorPlugins as G, insertKunSpoilerCommand as K, insertMentionCommand as q, insertQuoteCommand as J, kunCM as ee, mentionId as te, setHeadingCommand as ne, startImageUpload as re } from "@kungal/editor-core/preset";
|
|
10
10
|
import { TextSelection as ie } from "@milkdown/kit/prose/state";
|
|
11
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
12
|
import { toggleStrikethroughCommand as me } from "@milkdown/kit/preset/gfm";
|
|
@@ -74,7 +74,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
74
74
|
}, I = (e) => {
|
|
75
75
|
let t = d.value;
|
|
76
76
|
if (!t || !O) return;
|
|
77
|
-
let n = t.state.schema.nodes[
|
|
77
|
+
let n = t.state.schema.nodes[te];
|
|
78
78
|
if (!n) return;
|
|
79
79
|
let r = n.create({
|
|
80
80
|
userId: e.id,
|
|
@@ -156,39 +156,56 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
156
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
157
|
latex: Q("Σ", 15),
|
|
158
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 =
|
|
159
|
+
}, Ee = {
|
|
160
|
+
key: 0,
|
|
161
|
+
class: "kun-editor__toolbar-divider",
|
|
162
|
+
"aria-hidden": "true"
|
|
163
|
+
}, De = [
|
|
160
164
|
"title",
|
|
161
165
|
"aria-label",
|
|
162
166
|
"onMousedown"
|
|
163
|
-
],
|
|
167
|
+
], Oe = ["innerHTML"], ke = /* @__PURE__ */ s({
|
|
164
168
|
__name: "SelectionTooltip",
|
|
165
169
|
setup(n) {
|
|
166
170
|
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
171
|
s()?.action(U(e, t));
|
|
168
172
|
}, y = t(() => {
|
|
169
173
|
let e = u.value;
|
|
170
|
-
return
|
|
171
|
-
{
|
|
174
|
+
return {
|
|
175
|
+
bold: {
|
|
172
176
|
svg: $.bold,
|
|
173
177
|
title: e ? "Bold" : "加粗",
|
|
174
178
|
run: () => v(ue.key)
|
|
175
179
|
},
|
|
176
|
-
{
|
|
180
|
+
italic: {
|
|
177
181
|
svg: $.italic,
|
|
178
182
|
title: e ? "Italic" : "斜体",
|
|
179
183
|
run: () => v(ce.key)
|
|
180
184
|
},
|
|
181
|
-
{
|
|
185
|
+
strike: {
|
|
182
186
|
svg: $.strike,
|
|
183
187
|
title: e ? "Strikethrough" : "删除线",
|
|
184
188
|
run: () => v(me.key)
|
|
185
189
|
},
|
|
186
|
-
{
|
|
190
|
+
code: {
|
|
187
191
|
svg: $.code,
|
|
188
192
|
title: e ? "Inline code" : "行内代码",
|
|
189
193
|
run: () => v(le.key)
|
|
190
194
|
}
|
|
191
|
-
|
|
195
|
+
};
|
|
196
|
+
}), b = t(() => {
|
|
197
|
+
let e = y.value, t = (c?.selectionToolbarItems ?? [
|
|
198
|
+
"bold",
|
|
199
|
+
"italic",
|
|
200
|
+
"strike",
|
|
201
|
+
"code"
|
|
202
|
+
]).map((t) => t === "|" ? { divider: !0 } : e[t] ? {
|
|
203
|
+
divider: !1,
|
|
204
|
+
...e[t]
|
|
205
|
+
} : null).filter((e) => e !== null), n = [];
|
|
206
|
+
for (let e of t) e.divider && (n.length === 0 || n[n.length - 1]?.divider) || n.push(e);
|
|
207
|
+
for (; n.length && n[n.length - 1]?.divider;) n.pop();
|
|
208
|
+
return n;
|
|
192
209
|
});
|
|
193
210
|
return p(() => {
|
|
194
211
|
h = new V({
|
|
@@ -204,19 +221,19 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
204
221
|
ref: d,
|
|
205
222
|
class: "kun-editor__bubble",
|
|
206
223
|
"data-show": "false"
|
|
207
|
-
}, [(m(!0), i(e, null, _(
|
|
208
|
-
key:
|
|
224
|
+
}, [(m(!0), i(e, null, _(b.value, (t, n) => (m(), i(e, { key: n }, [t.divider ? (m(), i("span", Ee)) : (m(), i("button", {
|
|
225
|
+
key: 1,
|
|
209
226
|
type: "button",
|
|
210
227
|
class: "kun-editor__bubble-btn",
|
|
211
|
-
title:
|
|
212
|
-
"aria-label":
|
|
213
|
-
onMousedown: T((
|
|
228
|
+
title: t.title,
|
|
229
|
+
"aria-label": t.title,
|
|
230
|
+
onMousedown: T((e) => t.run(), ["prevent"])
|
|
214
231
|
}, [a("span", {
|
|
215
232
|
class: "kun-editor__icon",
|
|
216
|
-
innerHTML:
|
|
217
|
-
}, null, 8,
|
|
233
|
+
innerHTML: t.svg
|
|
234
|
+
}, null, 8, Oe)], 40, De))], 64))), 128))], 512));
|
|
218
235
|
}
|
|
219
|
-
}),
|
|
236
|
+
}), Ae = /* @__PURE__ */ s({
|
|
220
237
|
__name: "MilkdownEditor",
|
|
221
238
|
props: {
|
|
222
239
|
modelValue: {},
|
|
@@ -236,7 +253,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
236
253
|
}), t.update(I, (e) => ({
|
|
237
254
|
...e,
|
|
238
255
|
editable: () => !i.readonly
|
|
239
|
-
})), l && t.set(c.key, { view: s({ component: Te }) }), d && t.set(u.key, { view: s({ component:
|
|
256
|
+
})), l && t.set(c.key, { view: s({ component: Te }) }), d && t.set(u.key, { view: s({ component: ke }) });
|
|
240
257
|
}).use(G(i.adapters, i.features, {
|
|
241
258
|
locale: i.locale,
|
|
242
259
|
placeholder: i.placeholder
|
|
@@ -256,29 +273,29 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
256
273
|
};
|
|
257
274
|
return t({
|
|
258
275
|
insertQuote: (e) => {
|
|
259
|
-
f.get()?.action(U(
|
|
276
|
+
f.get()?.action(U(J.key, e)), p();
|
|
260
277
|
},
|
|
261
278
|
insertMention: (e) => {
|
|
262
|
-
f.get()?.action(U(
|
|
279
|
+
f.get()?.action(U(q.key, e)), p();
|
|
263
280
|
},
|
|
264
281
|
focus: p
|
|
265
282
|
}), (e, t) => (m(), n(b(E)));
|
|
266
283
|
}
|
|
267
|
-
}),
|
|
284
|
+
}), je = /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.🙃.😉.😊.😇.🥰.😍.🤩.😘.😗.😚.😋.😛.😜.🤪.😝.🤗.🤭.🤔.🤐.😐.😑.😶.😏.😒.🙄.😬.😌.😔.😪.🤤.😴.😷.🤒.🤕.🥵.🥶.🥴.😵.🤯.🤠.🥳.😎.🤓.🧐.😕.😟.🙁.😮.😯.😲.😳.🥺.😦.😧.😨.😰.😥.😢.😭.😱.😖.😣.😞.😓.😩.😫.🥱.😤.😡.😠.🤬.😈.👿.💀.💩.🤡.👻.👽.🤖.😺.😸.👍.👎.👌.🤌.🤏.✌️.🤞.🤟.🤘.👋.🤚.🖐️.✋.👏.🙌.🤝.🙏.💪.👀.👁️.❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.💕.💞.💓.💗.💖.💘.💝.💯.✨.⭐.🌟.🔥.💥.💫.⚡.☀️.🌈.🎉.🎊.🎁.🏆.🐶.🐱.🐭.🦊.🐻.🐼.🐨.🦄.🐢.🐳.🍎.🍑.🍓.🍉.🍰.🍺.🍵.☕.🍜.🍙.✅.❌.❓.❗.💤.👑.🎮.🎵.📌.🔖".split("."), Me = [
|
|
268
285
|
"title",
|
|
269
286
|
"aria-label",
|
|
270
287
|
"aria-expanded"
|
|
271
|
-
],
|
|
288
|
+
], Ne = ["innerHTML"], Pe = { class: "kun-editor__picker-panel" }, Fe = {
|
|
272
289
|
key: 0,
|
|
273
290
|
class: "kun-editor__picker-tabs",
|
|
274
291
|
role: "tablist"
|
|
275
|
-
},
|
|
292
|
+
}, Ie = ["data-active"], Le = ["data-active"], Re = { class: "kun-editor__emoji-grid" }, ze = ["onClick"], Be = {
|
|
276
293
|
key: 1,
|
|
277
294
|
class: "kun-editor__sticker-body"
|
|
278
|
-
},
|
|
295
|
+
}, Ve = { class: "kun-editor__pack-name" }, He = { class: "kun-editor__sticker-grid" }, Ue = ["title", "onClick"], We = ["src", "alt"], Ge = {
|
|
279
296
|
key: 1,
|
|
280
297
|
class: "kun-editor__picker-hint"
|
|
281
|
-
},
|
|
298
|
+
}, Ke = /* @__PURE__ */ s({
|
|
282
299
|
__name: "StickerPicker",
|
|
283
300
|
setup(n) {
|
|
284
301
|
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 ? {
|
|
@@ -334,28 +351,28 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
334
351
|
}, [a("span", {
|
|
335
352
|
class: "kun-editor__icon",
|
|
336
353
|
innerHTML: b($).smile
|
|
337
|
-
}, null, 8,
|
|
338
|
-
u ? (m(), i("div",
|
|
354
|
+
}, null, 8, Ne)], 8, Me), w(a("div", Pe, [
|
|
355
|
+
u ? (m(), i("div", Fe, [a("button", {
|
|
339
356
|
type: "button",
|
|
340
357
|
class: "kun-editor__picker-tab",
|
|
341
358
|
"data-active": C.value === "emoji",
|
|
342
359
|
onClick: n[0] ||= (e) => C.value = "emoji"
|
|
343
|
-
}, y(h.value.emoji), 9,
|
|
360
|
+
}, y(h.value.emoji), 9, Ie), a("button", {
|
|
344
361
|
type: "button",
|
|
345
362
|
class: "kun-editor__picker-tab",
|
|
346
363
|
"data-active": C.value === "sticker",
|
|
347
364
|
onClick: n[1] ||= (e) => C.value = "sticker"
|
|
348
|
-
}, y(h.value.sticker), 9,
|
|
349
|
-
w(a("div",
|
|
365
|
+
}, y(h.value.sticker), 9, Le)])) : r("", !0),
|
|
366
|
+
w(a("div", Re, [(m(!0), i(e, null, _(b(je), (e, t) => (m(), i("button", {
|
|
350
367
|
key: t,
|
|
351
368
|
type: "button",
|
|
352
369
|
class: "kun-editor__emoji",
|
|
353
370
|
onClick: (t) => M(e)
|
|
354
|
-
}, y(e), 9,
|
|
355
|
-
u ? w((m(), i("div",
|
|
371
|
+
}, y(e), 9, ze))), 128))], 512), [[x, !u || C.value === "emoji"]]),
|
|
372
|
+
u ? w((m(), i("div", Be, [T.value.length ? (m(!0), i(e, { key: 0 }, _(T.value, (t) => (m(), i("div", {
|
|
356
373
|
key: t.name,
|
|
357
374
|
class: "kun-editor__pack"
|
|
358
|
-
}, [a("div",
|
|
375
|
+
}, [a("div", Ve, y(t.name), 1), a("div", He, [(m(!0), i(e, null, _(t.stickers, (e, t) => (m(), i("button", {
|
|
359
376
|
key: t,
|
|
360
377
|
type: "button",
|
|
361
378
|
class: "kun-editor__sticker",
|
|
@@ -365,21 +382,21 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
365
382
|
src: e.src,
|
|
366
383
|
alt: e.name,
|
|
367
384
|
loading: "lazy"
|
|
368
|
-
}, null, 8,
|
|
385
|
+
}, null, 8, We)], 8, Ue))), 128))])]))), 128)) : (m(), i("div", Ge, y(D.value ? h.value.failed : h.value.empty), 1))], 512)), [[x, C.value === "sticker"]]) : r("", !0)
|
|
369
386
|
], 512), [[x, v.value]])], 512));
|
|
370
387
|
}
|
|
371
|
-
}),
|
|
388
|
+
}), qe = {
|
|
372
389
|
class: "kun-editor__format-toolbar",
|
|
373
390
|
role: "toolbar"
|
|
374
|
-
},
|
|
391
|
+
}, Je = ["aria-label"], Ye = {
|
|
375
392
|
value: "",
|
|
376
393
|
disabled: "",
|
|
377
394
|
selected: ""
|
|
378
|
-
},
|
|
395
|
+
}, Xe = ["value"], Ze = [
|
|
379
396
|
"title",
|
|
380
397
|
"aria-label",
|
|
381
398
|
"onClick"
|
|
382
|
-
],
|
|
399
|
+
], Qe = ["innerHTML"], $e = ["title", "aria-label"], et = ["innerHTML"], tt = /* @__PURE__ */ s({
|
|
383
400
|
__name: "EditorToolbar",
|
|
384
401
|
setup(n) {
|
|
385
402
|
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) => {
|
|
@@ -416,7 +433,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
416
433
|
}));
|
|
417
434
|
}), x = (e) => {
|
|
418
435
|
let t = e.target;
|
|
419
|
-
p(
|
|
436
|
+
p(ne.key, Number(t.value)), t.selectedIndex = 0;
|
|
420
437
|
}, S = t(() => [
|
|
421
438
|
[
|
|
422
439
|
{
|
|
@@ -470,29 +487,29 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
470
487
|
[{
|
|
471
488
|
svg: $.spoiler,
|
|
472
489
|
title: h.value.spoiler,
|
|
473
|
-
run: () => p(
|
|
490
|
+
run: () => p(K.key)
|
|
474
491
|
}]
|
|
475
492
|
]), C = g(null), w = () => C.value?.click(), T = (e) => {
|
|
476
493
|
let t = e.target, n = t.files?.[0];
|
|
477
494
|
t.value = "";
|
|
478
495
|
let r = u.value;
|
|
479
496
|
!n || !r || s()?.action((e) => {
|
|
480
|
-
|
|
497
|
+
re(e.get(F), n, {
|
|
481
498
|
uploadImage: r,
|
|
482
499
|
notify: c?.adapters.notify,
|
|
483
500
|
locale: c?.locale
|
|
484
501
|
});
|
|
485
502
|
});
|
|
486
503
|
};
|
|
487
|
-
return (t, n) => (m(), i("div",
|
|
504
|
+
return (t, n) => (m(), i("div", qe, [
|
|
488
505
|
a("select", {
|
|
489
506
|
class: "kun-editor__heading-select",
|
|
490
507
|
"aria-label": h.value.textSize,
|
|
491
508
|
onChange: x
|
|
492
|
-
}, [a("option",
|
|
509
|
+
}, [a("option", Ye, y(h.value.textSize), 1), (m(!0), i(e, null, _(v.value, (e) => (m(), i("option", {
|
|
493
510
|
key: e.level,
|
|
494
511
|
value: e.level
|
|
495
|
-
}, y(e.label), 9,
|
|
512
|
+
}, y(e.label), 9, Xe))), 128))], 40, Je),
|
|
496
513
|
(m(!0), i(e, null, _(S.value, (t, r) => (m(), i(e, { key: r }, [n[0] ||= a("span", {
|
|
497
514
|
class: "kun-editor__toolbar-divider",
|
|
498
515
|
"aria-hidden": "true"
|
|
@@ -506,7 +523,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
506
523
|
}, [a("span", {
|
|
507
524
|
class: "kun-editor__icon",
|
|
508
525
|
innerHTML: e.svg
|
|
509
|
-
}, null, 8,
|
|
526
|
+
}, null, 8, Qe)], 8, Ze))), 128))], 64))), 128)),
|
|
510
527
|
u.value ? (m(), i(e, { key: 0 }, [
|
|
511
528
|
n[1] ||= a("span", {
|
|
512
529
|
class: "kun-editor__toolbar-divider",
|
|
@@ -521,7 +538,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
521
538
|
}, [a("span", {
|
|
522
539
|
class: "kun-editor__icon",
|
|
523
540
|
innerHTML: b($).image
|
|
524
|
-
}, null, 8,
|
|
541
|
+
}, null, 8, et)], 8, $e),
|
|
525
542
|
a("input", {
|
|
526
543
|
ref_key: "fileInput",
|
|
527
544
|
ref: C,
|
|
@@ -534,10 +551,10 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
534
551
|
d.value ? (m(), i(e, { key: 1 }, [n[2] ||= a("span", {
|
|
535
552
|
class: "kun-editor__toolbar-divider",
|
|
536
553
|
"aria-hidden": "true"
|
|
537
|
-
}, null, -1), o(
|
|
554
|
+
}, null, -1), o(Ke)], 64)) : r("", !0)
|
|
538
555
|
]));
|
|
539
556
|
}
|
|
540
|
-
}),
|
|
557
|
+
}), nt = /* @__PURE__ */ s({
|
|
541
558
|
__name: "ToolbarHost",
|
|
542
559
|
setup(e) {
|
|
543
560
|
let [, t] = k(), n = l(X, void 0), r = (e, n) => {
|
|
@@ -555,7 +572,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
555
572
|
uploadImage: (e) => {
|
|
556
573
|
let r = n?.adapters.uploadImage, i = t();
|
|
557
574
|
!r || !i || i.action((t) => {
|
|
558
|
-
|
|
575
|
+
re(t.get(F), e, {
|
|
559
576
|
uploadImage: r,
|
|
560
577
|
notify: n?.adapters.notify,
|
|
561
578
|
locale: n?.locale
|
|
@@ -563,10 +580,10 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
563
580
|
});
|
|
564
581
|
},
|
|
565
582
|
insertQuote: (e) => {
|
|
566
|
-
r(
|
|
583
|
+
r(J.key, e), i();
|
|
567
584
|
},
|
|
568
585
|
insertMention: (e) => {
|
|
569
|
-
r(
|
|
586
|
+
r(q.key, e), i();
|
|
570
587
|
},
|
|
571
588
|
focus: i,
|
|
572
589
|
get adapters() {
|
|
@@ -581,7 +598,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
581
598
|
};
|
|
582
599
|
return (e, t) => v(e.$slots, "default", d(c(a)));
|
|
583
600
|
}
|
|
584
|
-
}),
|
|
601
|
+
}), rt = /* @__PURE__ */ s({
|
|
585
602
|
__name: "MarkdownSource",
|
|
586
603
|
props: {
|
|
587
604
|
modelValue: {},
|
|
@@ -592,7 +609,7 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
592
609
|
let n = e, r = t, a = g(null), o = null, s = (e) => he.create({
|
|
593
610
|
doc: e,
|
|
594
611
|
extensions: [
|
|
595
|
-
|
|
612
|
+
ee(),
|
|
596
613
|
Y.lineWrapping,
|
|
597
614
|
_e,
|
|
598
615
|
ge(),
|
|
@@ -617,19 +634,19 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
617
634
|
class: "kun-editor__source"
|
|
618
635
|
}, null, 512));
|
|
619
636
|
}
|
|
620
|
-
}),
|
|
637
|
+
}), it = ["data-mode"], at = {
|
|
621
638
|
key: 0,
|
|
622
639
|
class: "kun-editor__toolbar",
|
|
623
640
|
role: "tablist"
|
|
624
|
-
},
|
|
641
|
+
}, ot = [
|
|
625
642
|
"aria-selected",
|
|
626
643
|
"data-active",
|
|
627
644
|
"onClick"
|
|
628
|
-
],
|
|
645
|
+
], st = ["title", "aria-label"], ct = [
|
|
629
646
|
"data-active",
|
|
630
647
|
"title",
|
|
631
648
|
"aria-pressed"
|
|
632
|
-
],
|
|
649
|
+
], lt = ["data-swap"], ut = { class: "kun-editor__wysiwyg kun-editor__pane" }, dt = /* @__PURE__ */ s({
|
|
633
650
|
__name: "KunEditor",
|
|
634
651
|
props: {
|
|
635
652
|
modelValue: {},
|
|
@@ -651,39 +668,47 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
651
668
|
default: !0
|
|
652
669
|
},
|
|
653
670
|
selectionToolbar: {
|
|
654
|
-
type: Boolean,
|
|
671
|
+
type: [Boolean, Array],
|
|
655
672
|
default: !0
|
|
656
673
|
}
|
|
657
674
|
},
|
|
658
675
|
emits: ["update:modelValue"],
|
|
659
676
|
setup(s, { expose: l, emit: p }) {
|
|
660
|
-
let T =
|
|
677
|
+
let T = [
|
|
678
|
+
"bold",
|
|
679
|
+
"italic",
|
|
680
|
+
"strike",
|
|
681
|
+
"code"
|
|
682
|
+
], E = s, O = p;
|
|
661
683
|
h(X, {
|
|
662
684
|
get adapters() {
|
|
663
|
-
return
|
|
685
|
+
return E.adapters;
|
|
664
686
|
},
|
|
665
687
|
get features() {
|
|
666
|
-
return
|
|
688
|
+
return E.features;
|
|
667
689
|
},
|
|
668
690
|
get locale() {
|
|
669
|
-
return
|
|
691
|
+
return E.locale;
|
|
692
|
+
},
|
|
693
|
+
get selectionToolbarItems() {
|
|
694
|
+
return Array.isArray(E.selectionToolbar) ? E.selectionToolbar : T;
|
|
670
695
|
}
|
|
671
696
|
});
|
|
672
|
-
let
|
|
673
|
-
|
|
697
|
+
let k = t(() => E.selectionToolbar !== !1), j = g(E.views.includes("wysiwyg") ? "wysiwyg" : E.views[0] ?? "wysiwyg"), M = (e) => {
|
|
698
|
+
j.value = e;
|
|
674
699
|
};
|
|
675
|
-
S(() =>
|
|
676
|
-
e.includes(
|
|
700
|
+
S(() => E.views, (e) => {
|
|
701
|
+
e.includes(j.value) || (j.value = e[0] ?? "wysiwyg");
|
|
677
702
|
});
|
|
678
|
-
let
|
|
679
|
-
j.value = !j.value;
|
|
680
|
-
}, N = g(T.scrollSync);
|
|
681
|
-
S(() => T.scrollSync, (e) => {
|
|
682
|
-
N.value = e;
|
|
683
|
-
});
|
|
684
|
-
let P = () => {
|
|
703
|
+
let N = g(!1), P = () => {
|
|
685
704
|
N.value = !N.value;
|
|
686
|
-
}, F =
|
|
705
|
+
}, F = g(E.scrollSync);
|
|
706
|
+
S(() => E.scrollSync, (e) => {
|
|
707
|
+
F.value = e;
|
|
708
|
+
});
|
|
709
|
+
let I = () => {
|
|
710
|
+
F.value = !F.value;
|
|
711
|
+
}, L = t(() => E.locale.toLowerCase().startsWith("en")), R = t(() => L.value ? {
|
|
687
712
|
wysiwyg: "Preview",
|
|
688
713
|
source: "Markdown",
|
|
689
714
|
split: "Split",
|
|
@@ -695,94 +720,94 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
695
720
|
split: "分栏",
|
|
696
721
|
swap: "左右互换",
|
|
697
722
|
scrollSync: "同步滚动"
|
|
698
|
-
}),
|
|
699
|
-
|
|
700
|
-
},
|
|
701
|
-
|
|
702
|
-
let e =
|
|
723
|
+
}), z = g(null), B = null, V = null, H = null, U = () => {
|
|
724
|
+
B?.(), B = null, V = null;
|
|
725
|
+
}, W = () => {
|
|
726
|
+
U();
|
|
727
|
+
let e = z.value;
|
|
703
728
|
if (!e) return;
|
|
704
729
|
let t = e.querySelector(".cm-scroller"), n = e.querySelector(".kun-editor__wysiwyg");
|
|
705
730
|
if (!t || !n) return;
|
|
706
731
|
let r = (e, t) => () => {
|
|
707
|
-
if (
|
|
708
|
-
|
|
732
|
+
if (V && V !== e) return;
|
|
733
|
+
V = e;
|
|
709
734
|
let n = e.scrollHeight - e.clientHeight, r = n > 0 ? e.scrollTop / n : 0, i = t.scrollHeight - t.clientHeight;
|
|
710
|
-
t.scrollTop = r * (i > 0 ? i : 0),
|
|
711
|
-
|
|
735
|
+
t.scrollTop = r * (i > 0 ? i : 0), H && clearTimeout(H), H = setTimeout(() => {
|
|
736
|
+
V = null;
|
|
712
737
|
}, 120);
|
|
713
738
|
}, i = r(t, n), a = r(n, t);
|
|
714
|
-
t.addEventListener("scroll", i, { passive: !0 }), n.addEventListener("scroll", a, { passive: !0 }),
|
|
739
|
+
t.addEventListener("scroll", i, { passive: !0 }), n.addEventListener("scroll", a, { passive: !0 }), B = () => {
|
|
715
740
|
t.removeEventListener("scroll", i), n.removeEventListener("scroll", a);
|
|
716
741
|
};
|
|
717
742
|
};
|
|
718
|
-
S([
|
|
719
|
-
|
|
720
|
-
}), f(
|
|
721
|
-
let
|
|
743
|
+
S([j, F], ([e, t]) => {
|
|
744
|
+
U(), e === "split" && t && u(W);
|
|
745
|
+
}), f(U);
|
|
746
|
+
let G = t(() => E.readonly || j.value === "split"), K = (e) => O("update:modelValue", e), q = g(null);
|
|
722
747
|
return l({
|
|
723
|
-
insertQuote: (e) =>
|
|
724
|
-
insertMention: (e) =>
|
|
725
|
-
focus: () =>
|
|
748
|
+
insertQuote: (e) => q.value?.insertQuote(e),
|
|
749
|
+
insertMention: (e) => q.value?.insertMention(e),
|
|
750
|
+
focus: () => q.value?.focus()
|
|
726
751
|
}), (t, l) => (m(), i("div", {
|
|
727
752
|
ref_key: "rootEl",
|
|
728
|
-
ref:
|
|
753
|
+
ref: z,
|
|
729
754
|
class: "kun-editor",
|
|
730
755
|
"data-kun-editor": "",
|
|
731
|
-
"data-mode":
|
|
756
|
+
"data-mode": j.value
|
|
732
757
|
}, [v(t.$slots, "view-switch", {
|
|
733
|
-
mode:
|
|
734
|
-
setMode:
|
|
735
|
-
labels:
|
|
758
|
+
mode: j.value,
|
|
759
|
+
setMode: M,
|
|
760
|
+
labels: R.value,
|
|
736
761
|
views: s.views,
|
|
737
|
-
swapped:
|
|
738
|
-
swap:
|
|
739
|
-
scrollSync:
|
|
740
|
-
toggleScrollSync:
|
|
741
|
-
}, () => [s.views.length > 1 ? (m(), i("div",
|
|
762
|
+
swapped: N.value,
|
|
763
|
+
swap: P,
|
|
764
|
+
scrollSync: F.value,
|
|
765
|
+
toggleScrollSync: I
|
|
766
|
+
}, () => [s.views.length > 1 ? (m(), i("div", at, [(m(!0), i(e, null, _(s.views, (e) => (m(), i("button", {
|
|
742
767
|
key: e,
|
|
743
768
|
type: "button",
|
|
744
769
|
class: "kun-editor__tab",
|
|
745
|
-
"aria-selected":
|
|
746
|
-
"data-active":
|
|
747
|
-
onClick: (t) =>
|
|
748
|
-
}, y(
|
|
770
|
+
"aria-selected": j.value === e,
|
|
771
|
+
"data-active": j.value === e,
|
|
772
|
+
onClick: (t) => M(e)
|
|
773
|
+
}, y(R.value[e]), 9, ot))), 128)), j.value === "split" ? (m(), i(e, { key: 0 }, [a("button", {
|
|
749
774
|
type: "button",
|
|
750
775
|
class: "kun-editor__tab kun-editor__swap",
|
|
751
|
-
title:
|
|
752
|
-
"aria-label":
|
|
753
|
-
onClick: l[0] ||= (e) =>
|
|
754
|
-
}, " ⇄ ", 8,
|
|
776
|
+
title: R.value.swap,
|
|
777
|
+
"aria-label": R.value.swap,
|
|
778
|
+
onClick: l[0] ||= (e) => P()
|
|
779
|
+
}, " ⇄ ", 8, st), a("button", {
|
|
755
780
|
type: "button",
|
|
756
781
|
class: "kun-editor__tab",
|
|
757
|
-
"data-active":
|
|
758
|
-
title:
|
|
759
|
-
"aria-pressed":
|
|
760
|
-
onClick: l[1] ||= (e) =>
|
|
761
|
-
}, y(
|
|
782
|
+
"data-active": F.value,
|
|
783
|
+
title: R.value.scrollSync,
|
|
784
|
+
"aria-pressed": F.value,
|
|
785
|
+
onClick: l[1] ||= (e) => I()
|
|
786
|
+
}, y(R.value.scrollSync), 9, ct)], 64)) : r("", !0)])) : r("", !0)]), o(b(D), null, {
|
|
762
787
|
default: C(() => [o(b(A), null, {
|
|
763
|
-
default: C(() => [w(a("div", null, [o(
|
|
764
|
-
default: C((e) => [v(t.$slots, "toolbar", d(c(e)), () => [o(
|
|
788
|
+
default: C(() => [w(a("div", null, [o(nt, null, {
|
|
789
|
+
default: C((e) => [v(t.$slots, "toolbar", d(c(e)), () => [o(tt)])]),
|
|
765
790
|
_: 3
|
|
766
|
-
})], 512), [[x,
|
|
791
|
+
})], 512), [[x, j.value === "wysiwyg" && !s.readonly]]), a("div", {
|
|
767
792
|
class: "kun-editor__panes",
|
|
768
|
-
"data-swap":
|
|
769
|
-
}, [
|
|
793
|
+
"data-swap": N.value
|
|
794
|
+
}, [j.value === "source" || j.value === "split" ? (m(), n(rt, {
|
|
770
795
|
key: 0,
|
|
771
796
|
class: "kun-editor__pane",
|
|
772
797
|
"model-value": s.modelValue,
|
|
773
798
|
readonly: s.readonly,
|
|
774
|
-
"onUpdate:modelValue":
|
|
775
|
-
}, null, 8, ["model-value", "readonly"])) : r("", !0), w(a("div",
|
|
799
|
+
"onUpdate:modelValue": K
|
|
800
|
+
}, null, 8, ["model-value", "readonly"])) : r("", !0), w(a("div", ut, [o(Ae, {
|
|
776
801
|
ref_key: "inner",
|
|
777
|
-
ref:
|
|
802
|
+
ref: q,
|
|
778
803
|
"model-value": s.modelValue,
|
|
779
804
|
adapters: s.adapters,
|
|
780
805
|
features: s.features,
|
|
781
806
|
locale: s.locale,
|
|
782
|
-
readonly:
|
|
807
|
+
readonly: G.value,
|
|
783
808
|
placeholder: s.placeholder,
|
|
784
|
-
"selection-toolbar":
|
|
785
|
-
"onUpdate:modelValue":
|
|
809
|
+
"selection-toolbar": k.value,
|
|
810
|
+
"onUpdate:modelValue": K
|
|
786
811
|
}, null, 8, [
|
|
787
812
|
"model-value",
|
|
788
813
|
"adapters",
|
|
@@ -791,14 +816,14 @@ var X = Symbol("kun-editor-context"), ve = [
|
|
|
791
816
|
"readonly",
|
|
792
817
|
"placeholder",
|
|
793
818
|
"selection-toolbar"
|
|
794
|
-
])], 512), [[x,
|
|
819
|
+
])], 512), [[x, j.value === "wysiwyg" || j.value === "split"]])], 8, lt)]),
|
|
795
820
|
_: 3
|
|
796
821
|
})]),
|
|
797
822
|
_: 3
|
|
798
|
-
})], 8,
|
|
823
|
+
})], 8, it));
|
|
799
824
|
}
|
|
800
|
-
}),
|
|
801
|
-
e.component("KunEditor",
|
|
825
|
+
}), ft = { install(e) {
|
|
826
|
+
e.component("KunEditor", dt);
|
|
802
827
|
} };
|
|
803
828
|
//#endregion
|
|
804
|
-
export {
|
|
829
|
+
export { je as EMOJI, dt as KunEditor, ft as KunEditorPlugin };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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' | 'image' | 'picker' | '|';
|
|
4
|
+
export type KunSelectionItem = 'bold' | 'italic' | 'strike' | 'code' | '|';
|
|
4
5
|
export interface KunEditorToolbarApi {
|
|
5
6
|
/** Run a Milkdown command (import its key from the preset/commonmark/gfm). */
|
|
6
7
|
run: <T>(key: CmdKey<T>, payload?: T) => void;
|
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,OAAO,GACP,QAAQ,GACR,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,aAAa,GACb,OAAO,GACP,WAAW,GACX,IAAI,GACJ,SAAS,GACT,OAAO,GACP,QAAQ,GACR,GAAG,CAAA;AAIP,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,GAAG,CAAA;AAM1E,MAAM,WAAW,mBAAmB;IAClC,8EAA8E;IAC9E,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,IAAI,CAAA;IAC7C,uDAAuD;IACvD,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACjC,0EAA0E;IAC1E,WAAW,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAChE,6CAA6C;IAC7C,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAClE,gCAAgC;IAChC,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CACjC;AAMD,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;IACpC,8BAA8B;IAC9B,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,KAAK,IAAI,CAAA;IACvD,8EAA8E;IAC9E,KAAK,EAAE,CAAC,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAA;IACzC,qDAAqD;IACrD,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAA;IAChB,gDAAgD;IAChD,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAAA;IACnB,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,IAAI,CAAA;CAC7B;AASD,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC5D;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC9D,gCAAgC;IAChC,KAAK,IAAI,IAAI,CAAA;CACd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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.24.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.24.0"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "vite build && vue-tsc -p tsconfig.build.json",
|