@kungal/editor-vue 0.31.1 → 0.32.1
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 +32 -0
- package/dist/active-marks.d.ts +12 -0
- package/dist/active-marks.d.ts.map +1 -0
- package/dist/components/EditorToolbar.vue.d.ts.map +1 -1
- package/dist/components/KunEditor.vue.d.ts +1 -0
- package/dist/components/KunEditor.vue.d.ts.map +1 -1
- package/dist/components/MilkdownEditor.vue.d.ts.map +1 -1
- package/dist/components/SelectionTooltip.vue.d.ts.map +1 -1
- package/dist/components/ToolbarHost.vue.d.ts +1 -0
- package/dist/components/ToolbarHost.vue.d.ts.map +1 -1
- package/dist/context.d.ts +7 -1
- 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 +361 -307
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @kungal/editor-vue
|
|
2
2
|
|
|
3
|
+
## 0.32.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 814c98f: Drive toolbar and bubble toggle-mark state from one editor plugin view, and keep the orphan-link cleanup out of undo history.
|
|
8
|
+
|
|
9
|
+
The previous Milkdown-listener + per-toolbar `refresh()` pair leaked subscriptions, missed stored-mark toggles for 200ms, and left the selection bubble without a pressed state. A single ProseMirror `view.update` plugin now writes one reactive record that the toolbar, the `#toolbar` slot, and the bubble all read. The leftover stored-link cleanup is marked `addToHistory: false`.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [814c98f]
|
|
12
|
+
- @kungal/editor-core@0.32.1
|
|
13
|
+
|
|
14
|
+
## 0.32.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 7dd7f71: Show an active state on the toolbar's toggle marks (bold / italic /
|
|
19
|
+
strikethrough / inline code).
|
|
20
|
+
|
|
21
|
+
The toolbar buttons ran the toggle commands but never reflected whether the
|
|
22
|
+
mark was on, so a user could not tell if bold (etc.) was engaged. The
|
|
23
|
+
`#toolbar` slot API now exposes a reactive `activeMarks` map (bold / italic /
|
|
24
|
+
strike / code), recomputed from the ProseMirror selection on selection and doc
|
|
25
|
+
changes and immediately after each command. `<KunEditorToolbar>` renders the
|
|
26
|
+
pressed buttons with the primary "active" look (same as hover) and sets
|
|
27
|
+
`aria-pressed`; the headless `EditorToolbar` sets `data-active` for the
|
|
28
|
+
`.kun-editor__tool[data-active='true']` style.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [35bc140]
|
|
33
|
+
- @kungal/editor-core@0.32.0
|
|
34
|
+
|
|
3
35
|
## 0.31.1
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EditorState } from '@milkdown/kit/prose/state';
|
|
2
|
+
import type { Ctx } from '@milkdown/kit/ctx';
|
|
3
|
+
import type { KunToggleMark } from './types';
|
|
4
|
+
export declare const TOGGLE_MARKS: readonly ["bold", "italic", "strike", "code"];
|
|
5
|
+
export declare const createEmptyActiveMarks: () => Record<KunToggleMark, boolean>;
|
|
6
|
+
export declare const EMPTY_ACTIVE_MARKS: Readonly<Record<KunToggleMark, boolean>>;
|
|
7
|
+
/** Same decision `toggleMark` itself uses: stored marks at an empty caret,
|
|
8
|
+
* `rangeHasMark` (any overlap) on a range. */
|
|
9
|
+
export declare const readActiveMarks: (state: EditorState, ctx: Ctx) => Record<KunToggleMark, boolean>;
|
|
10
|
+
/** Keep `target` in sync with the editor view for the life of the editor. */
|
|
11
|
+
export declare const createActiveMarksPlugin: (target: Record<KunToggleMark, boolean>) => import("@milkdown/kit/utils").$Prose;
|
|
12
|
+
//# sourceMappingURL=active-marks.d.ts.map
|
|
@@ -0,0 +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,CAKrE,CAAA;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAC/B,CAAA;AAEzC;8CAC8C;AAC9C,eAAO,MAAM,eAAe,GAC1B,OAAO,WAAW,EAClB,KAAK,GAAG,KACP,MAAM,CAAC,aAAa,EAAE,OAAO,CAU/B,CAAA;AAiBD,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,yCAerC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorToolbar.vue.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.vue"],"names":[],"mappings":"AAsgBA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -54,6 +54,7 @@ declare var __VLS_1: {
|
|
|
54
54
|
toggleScrollSync: () => void;
|
|
55
55
|
}, __VLS_22: {
|
|
56
56
|
run: <T>(key: import("@milkdown/kit/core").CmdKey<T>, payload?: T) => void;
|
|
57
|
+
activeMarks: Readonly<Record<import("../types").KunToggleMark, boolean>>;
|
|
57
58
|
insertText: (text: string) => void;
|
|
58
59
|
uploadImage: (file: File) => void;
|
|
59
60
|
insertImage: (payload: {
|
|
@@ -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":"AA8bA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACX,MAAM,qBAAqB,CAAA;AAQ5B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAUjE,KAAK,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE9C,KAAK,WAAW,GAAG;IACf,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,qDAAqD;IACrD,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,KAAK,GAAG,OAAO,CAAA;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAA;IAClB;oEACgE;IAChE,UAAU,CAAC,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,CAjYO;;;;;;WAiYP,CA3W2D;aA2W3D,CAzWO;;;;YAyWP,CApWyB;;;;;;;;;;;;;;CAi6BiB,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;;;;;;;;;cAjiBD,iBAAiB;cAEjB,iBAAiB;YAEnB,eAAe;cAEb,OAAO;iBAEJ,MAAM;qBAMF,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":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MilkdownEditor.vue.d.ts","sourceRoot":"","sources":["../../src/components/MilkdownEditor.vue"],"names":[],"mappings":"AAwTA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,KAAK,GAAG,OAAO,CAAA;IAChC,gBAAgB,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,MAAM,EAAE,OAAO,CAAA;CAChB,CAAC;AAyPF,QAAA,MAAM,YAAY;;;;;;kFAIhB,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":"AA8UA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CmdKey } from '@milkdown/kit/core';
|
|
2
2
|
declare var __VLS_1: {
|
|
3
3
|
run: <T>(key: CmdKey<T>, payload?: T) => void;
|
|
4
|
+
activeMarks: Readonly<Record<import("..").KunToggleMark, boolean>>;
|
|
4
5
|
insertText: (text: string) => void;
|
|
5
6
|
uploadImage: (file: File) => void;
|
|
6
7
|
insertImage: (payload: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarHost.vue.d.ts","sourceRoot":"","sources":["../../src/components/ToolbarHost.vue"],"names":[],"mappings":"
|
|
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,CAlEiE;;;;;;WAkEjE,CApBE;aAoBF,CApBkB;;;;YAYmD,CAAC;;;;;;;;;;;;;;CAoHhD,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,6 +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
|
+
import type { KunSelectionItem, KunToggleMark } from './types';
|
|
4
4
|
export interface KunEditorContext {
|
|
5
5
|
/** The host policy bundle (searchMentionUsers, stickerSource, notify, …). */
|
|
6
6
|
readonly adapters: KunEditorAdapters;
|
|
@@ -10,6 +10,12 @@ export interface KunEditorContext {
|
|
|
10
10
|
readonly locale: KunEditorLocale;
|
|
11
11
|
/** Ordered buttons for the selection bubble toolbar (a plugin view reads it). */
|
|
12
12
|
readonly selectionToolbarItems: KunSelectionItem[];
|
|
13
|
+
/**
|
|
14
|
+
* Live toggle-mark state (bold / italic / strike / code). Mutated in place
|
|
15
|
+
* by the editor's active-marks plugin on every view update — toolbar and
|
|
16
|
+
* bubble both read this same object.
|
|
17
|
+
*/
|
|
18
|
+
readonly activeMarks: Record<KunToggleMark, boolean>;
|
|
13
19
|
}
|
|
14
20
|
export declare const KUN_EDITOR_CONTEXT: InjectionKey<KunEditorContext>;
|
|
15
21
|
//# 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;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,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,aAAa,EAAE,MAAM,SAAS,CAAA;AAE9D,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;IAClD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;CACrD;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,gBAAgB,CAChC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type { KunEditorExpose } from './types';
|
|
|
5
5
|
export type { KunEditorToolbarApi } from './types';
|
|
6
6
|
export type { KunToolbarItem } from './types';
|
|
7
7
|
export type { KunSelectionItem } from './types';
|
|
8
|
+
export type { KunToggleMark } from './types';
|
|
8
9
|
export type { KunEditorViewSwitchApi } from './types';
|
|
9
10
|
export { EMOJI } from './emoji';
|
|
10
11
|
export type { KunHeading } 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,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,+EAA+E;AAC/E,eAAO,MAAM,eAAe,EAAE,MAI7B,CAAA"}
|
|
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,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,+EAA+E;AAC/E,eAAO,MAAM,eAAe,EAAE,MAI7B,CAAA"}
|