@kungal/editor-core 0.32.1 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,86 @@
1
1
  # @kungal/editor-core
2
2
 
3
+ ## 0.34.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ab7fbc2: No native `prompt` left: the headless toolbar gets a link URL panel too
8
+
9
+ 0.33.0 gave the selection bubble an inline URL input; the fixed (headless)
10
+ toolbar still popped `window.prompt`. It now opens a small panel under the link
11
+ button — Enter applies, Esc cancels, clicking outside closes, and the editor
12
+ gets focus back. Same behaviour as the bubble otherwise: an existing href is
13
+ prefilled (and selected), and with nothing selected the URL is inserted as
14
+ linked text. A panel rather than an in-place swap because a fixed toolbar row
15
+ that rearranges itself is jarring; the bubble is already a floating layer, so
16
+ there the swap is the right shape.
17
+
18
+ **Breaking (CSS hook, one version old):** `.kun-editor__bubble-input` →
19
+ `.kun-editor__link-input`. Both entry points render the same input, so the hook
20
+ is named after the thing, not the place. Hosts importing
21
+ `@kungal/editor-nuxt/editor.css` need no change; a copied stylesheet wants the
22
+ rename plus the two new hooks:
23
+
24
+ ```css
25
+ .kun-editor__link {
26
+ position: relative;
27
+ } /* structural */
28
+ .kun-editor__link-panel {
29
+ position: absolute;
30
+ } /* structural */
31
+ .kun-editor__link-input {
32
+ /* shared by the toolbar panel and the bubble */
33
+ }
34
+ ```
35
+
36
+ `linkPrompt` keeps taking precedence over all three built-in entries (bubble
37
+ input, toolbar panel, KunUI popover), so a host modal is still one override.
38
+
39
+ ## 0.33.0
40
+
41
+ ### Minor Changes
42
+
43
+ - 9294ba2: Insert a link from the selection bubble without a native `prompt`
44
+
45
+ Selecting text → 「链接」 used to pop `window.prompt`. The bubble now asks for the
46
+ URL **in place**: the button row swaps for a URL input (`data-mode="link"`),
47
+ Enter applies, Esc cancels, and the row comes back. If the selection is already
48
+ a link its href is prefilled (and selected), so editing a URL is the same flow.
49
+
50
+ Why in place, and not a popover/dialog: the bubble is a Milkdown tooltip whose
51
+ `shouldShow` keeps it alive only while focus is in the editor **or inside the
52
+ bubble element**. Any popover teleports its panel to `<body>` — outside that
53
+ element — so the bubble would hide the moment the panel's input took focus. An
54
+ input in our own DOM keeps the bubble put, and the ProseMirror selection
55
+ survives the DOM blur, so the link wraps exactly what was selected.
56
+
57
+ Still headless: a plain `<input>` plus one new class hook.
58
+
59
+ ```css
60
+ .kun-editor__bubble[data-mode="link"] {
61
+ /* the URL-entry state */
62
+ }
63
+ .kun-editor__bubble-input {
64
+ /* the input itself */
65
+ }
66
+ ```
67
+
68
+ Hosts that want their own UI keep the escape hatch — the `linkPrompt` adapter
69
+ takes precedence over the inline input, exactly as it does over the KunUI
70
+ toolbar's popover.
71
+
72
+ Also in the shipped reference stylesheet (`@kungal/editor-nuxt/editor.css`): the
73
+ selection bubble, the @mention dropdown and the sticker/emoji picker painted
74
+ themselves with `--color-background` — KunUI's _glassy page_ tint (0.7 alpha) —
75
+ so document text showed through a panel floating over it. They now use the
76
+ RAISED surface token the KunUI popovers use, via one overridable var:
77
+
78
+ ```css
79
+ :root {
80
+ --kun-editor-surface: var(--color-content1, var(--color-background));
81
+ }
82
+ ```
83
+
3
84
  ## 0.32.1
4
85
 
5
86
  ### Patch Changes
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { K as KunEditorAdapters, a as KunEditorFeatures, b as KunEditorLocale, L as LinkPrompt, M as MentionUser, N as Notify, c as NotifyLevel, S as SearchMentionUsers, d as StickerItem, e as StickerPack, f as StickerSource, U as UploadImage } from './types-BazCkMGt.cjs';
1
+ export { K as KunEditorAdapters, a as KunEditorFeatures, b as KunEditorLocale, L as LinkPrompt, M as MentionUser, N as Notify, c as NotifyLevel, S as SearchMentionUsers, d as StickerItem, e as StickerPack, f as StickerSource, U as UploadImage } from './types-Dui0tGlh.cjs';
2
2
 
3
3
  interface KunHeading {
4
4
  /** Heading level 1–6. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { K as KunEditorAdapters, a as KunEditorFeatures, b as KunEditorLocale, L as LinkPrompt, M as MentionUser, N as Notify, c as NotifyLevel, S as SearchMentionUsers, d as StickerItem, e as StickerPack, f as StickerSource, U as UploadImage } from './types-BazCkMGt.js';
1
+ export { K as KunEditorAdapters, a as KunEditorFeatures, b as KunEditorLocale, L as LinkPrompt, M as MentionUser, N as Notify, c as NotifyLevel, S as SearchMentionUsers, d as StickerItem, e as StickerPack, f as StickerSource, U as UploadImage } from './types-Dui0tGlh.js';
2
2
 
3
3
  interface KunHeading {
4
4
  /** Heading level 1–6. */
@@ -1,6 +1,6 @@
1
1
  import { MilkdownPlugin, Ctx } from '@milkdown/kit/ctx';
2
2
  import { KatexOptions } from 'katex';
3
- import { b as KunEditorLocale, N as Notify, U as UploadImage, K as KunEditorAdapters, a as KunEditorFeatures } from '../types-BazCkMGt.cjs';
3
+ import { b as KunEditorLocale, N as Notify, U as UploadImage, K as KunEditorAdapters, a as KunEditorFeatures } from '../types-Dui0tGlh.cjs';
4
4
  import * as _milkdown_kit_utils from '@milkdown/kit/utils';
5
5
  import { Extension } from '@codemirror/state';
6
6
  import { Uploader } from '@milkdown/kit/plugin/upload';
@@ -1,6 +1,6 @@
1
1
  import { MilkdownPlugin, Ctx } from '@milkdown/kit/ctx';
2
2
  import { KatexOptions } from 'katex';
3
- import { b as KunEditorLocale, N as Notify, U as UploadImage, K as KunEditorAdapters, a as KunEditorFeatures } from '../types-BazCkMGt.js';
3
+ import { b as KunEditorLocale, N as Notify, U as UploadImage, K as KunEditorAdapters, a as KunEditorFeatures } from '../types-Dui0tGlh.js';
4
4
  import * as _milkdown_kit_utils from '@milkdown/kit/utils';
5
5
  import { Extension } from '@codemirror/state';
6
6
  import { Uploader } from '@milkdown/kit/plugin/upload';
@@ -48,11 +48,10 @@ type NotifyLevel = 'info' | 'success' | 'warn' | 'error';
48
48
  type Notify = (message: string, level: NotifyLevel) => void;
49
49
  /**
50
50
  * Ask the user for a link URL — provide this to show your OWN UI (a modal, an
51
- * inline input, an article picker…) instead of the native `window.prompt` the
52
- * headless toolbar / selection bubble fall back to. Gets the currently selected
53
- * text (to prefill or search). Return the URL, or a falsy value to cancel. When
54
- * set, the KunUI `<KunEditorToolbar>` uses it too instead of its inline popover,
55
- * so one override covers every link entry point.
51
+ * article picker…) instead of the built-in entry: the selection bubble's inline
52
+ * URL input, the headless toolbar's URL panel, or the KunUI toolbar's popover.
53
+ * Gets the currently selected text (to prefill or search). Return the URL, or a
54
+ * falsy value to cancel. One override covers every link entry point.
56
55
  */
57
56
  type LinkPrompt = (context: {
58
57
  text: string;
@@ -69,8 +68,9 @@ interface KunEditorAdapters {
69
68
  stickerSource?: StickerSource;
70
69
  notify?: Notify;
71
70
  /**
72
- * Custom link-URL entry (replaces the native prompt in the headless toolbar /
73
- * bubble, and the KunUI toolbar's popover). See {@link LinkPrompt}.
71
+ * Custom link-URL entry (replaces the selection bubble's inline input, the
72
+ * headless toolbar's URL panel, and the KunUI toolbar's popover). See
73
+ * {@link LinkPrompt}.
74
74
  */
75
75
  linkPrompt?: LinkPrompt;
76
76
  /**
@@ -48,11 +48,10 @@ type NotifyLevel = 'info' | 'success' | 'warn' | 'error';
48
48
  type Notify = (message: string, level: NotifyLevel) => void;
49
49
  /**
50
50
  * Ask the user for a link URL — provide this to show your OWN UI (a modal, an
51
- * inline input, an article picker…) instead of the native `window.prompt` the
52
- * headless toolbar / selection bubble fall back to. Gets the currently selected
53
- * text (to prefill or search). Return the URL, or a falsy value to cancel. When
54
- * set, the KunUI `<KunEditorToolbar>` uses it too instead of its inline popover,
55
- * so one override covers every link entry point.
51
+ * article picker…) instead of the built-in entry: the selection bubble's inline
52
+ * URL input, the headless toolbar's URL panel, or the KunUI toolbar's popover.
53
+ * Gets the currently selected text (to prefill or search). Return the URL, or a
54
+ * falsy value to cancel. One override covers every link entry point.
56
55
  */
57
56
  type LinkPrompt = (context: {
58
57
  text: string;
@@ -69,8 +68,9 @@ interface KunEditorAdapters {
69
68
  stickerSource?: StickerSource;
70
69
  notify?: Notify;
71
70
  /**
72
- * Custom link-URL entry (replaces the native prompt in the headless toolbar /
73
- * bubble, and the KunUI toolbar's popover). See {@link LinkPrompt}.
71
+ * Custom link-URL entry (replaces the selection bubble's inline input, the
72
+ * headless toolbar's URL panel, and the KunUI toolbar's popover). See
73
+ * {@link LinkPrompt}.
74
74
  */
75
75
  linkPrompt?: LinkPrompt;
76
76
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-core",
3
- "version": "0.32.1",
3
+ "version": "0.34.0",
4
4
  "description": "KunEditor framework-agnostic core — the Milkdown plugin bundle (spoiler / mention / quote / katex / upload / code-block) plus the adapter contracts. No Vue/React.",
5
5
  "type": "module",
6
6
  "keywords": [