@kungal/editor-vue 0.32.0 → 0.33.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 +61 -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 -1
- 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.map +1 -1
- package/dist/context.d.ts +7 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/index.js +433 -348
- package/dist/toolbar-icons.d.ts +2 -0
- package/dist/toolbar-icons.d.ts.map +1 -1
- package/dist/types.d.ts +4 -4
- package/package.json +3 -3
- package/dist/composables/useActiveMarks.d.ts +0 -10
- package/dist/composables/useActiveMarks.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# @kungal/editor-vue
|
|
2
2
|
|
|
3
|
+
## 0.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9294ba2: Insert a link from the selection bubble without a native `prompt`
|
|
8
|
+
|
|
9
|
+
Selecting text → 「链接」 used to pop `window.prompt`. The bubble now asks for the
|
|
10
|
+
URL **in place**: the button row swaps for a URL input (`data-mode="link"`),
|
|
11
|
+
Enter applies, Esc cancels, and the row comes back. If the selection is already
|
|
12
|
+
a link its href is prefilled (and selected), so editing a URL is the same flow.
|
|
13
|
+
|
|
14
|
+
Why in place, and not a popover/dialog: the bubble is a Milkdown tooltip whose
|
|
15
|
+
`shouldShow` keeps it alive only while focus is in the editor **or inside the
|
|
16
|
+
bubble element**. Any popover teleports its panel to `<body>` — outside that
|
|
17
|
+
element — so the bubble would hide the moment the panel's input took focus. An
|
|
18
|
+
input in our own DOM keeps the bubble put, and the ProseMirror selection
|
|
19
|
+
survives the DOM blur, so the link wraps exactly what was selected.
|
|
20
|
+
|
|
21
|
+
Still headless: a plain `<input>` plus one new class hook.
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
.kun-editor__bubble[data-mode="link"] {
|
|
25
|
+
/* the URL-entry state */
|
|
26
|
+
}
|
|
27
|
+
.kun-editor__bubble-input {
|
|
28
|
+
/* the input itself */
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Hosts that want their own UI keep the escape hatch — the `linkPrompt` adapter
|
|
33
|
+
takes precedence over the inline input, exactly as it does over the KunUI
|
|
34
|
+
toolbar's popover.
|
|
35
|
+
|
|
36
|
+
Also in the shipped reference stylesheet (`@kungal/editor-nuxt/editor.css`): the
|
|
37
|
+
selection bubble, the @mention dropdown and the sticker/emoji picker painted
|
|
38
|
+
themselves with `--color-background` — KunUI's _glassy page_ tint (0.7 alpha) —
|
|
39
|
+
so document text showed through a panel floating over it. They now use the
|
|
40
|
+
RAISED surface token the KunUI popovers use, via one overridable var:
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
:root {
|
|
44
|
+
--kun-editor-surface: var(--color-content1, var(--color-background));
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [9294ba2]
|
|
51
|
+
- @kungal/editor-core@0.33.0
|
|
52
|
+
|
|
53
|
+
## 0.32.1
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- 814c98f: Drive toolbar and bubble toggle-mark state from one editor plugin view, and keep the orphan-link cleanup out of undo history.
|
|
58
|
+
|
|
59
|
+
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`.
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [814c98f]
|
|
62
|
+
- @kungal/editor-core@0.32.1
|
|
63
|
+
|
|
3
64
|
## 0.32.0
|
|
4
65
|
|
|
5
66
|
### Minor 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"}
|
|
@@ -95,11 +95,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, KunEditorEx
|
|
|
95
95
|
"onUpdate:loading"?: ((loading: boolean) => any) | undefined;
|
|
96
96
|
"onUpdate:headings"?: ((headings: KunHeading[]) => any) | undefined;
|
|
97
97
|
}>, {
|
|
98
|
+
placeholder: string;
|
|
98
99
|
adapters: KunEditorAdapters;
|
|
99
100
|
features: KunEditorFeatures;
|
|
100
101
|
locale: KunEditorLocale;
|
|
101
102
|
readonly: boolean;
|
|
102
|
-
placeholder: string;
|
|
103
103
|
placeholderMode: "doc" | "block";
|
|
104
104
|
selectionToolbar: boolean | KunSelectionItem[];
|
|
105
105
|
views: ViewMode[];
|
|
@@ -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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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":"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":"AA0lBA,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":"
|
|
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"}
|