@kungal/editor-core 0.32.1 → 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 CHANGED
@@ -1,5 +1,50 @@
1
1
  # @kungal/editor-core
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
+
3
48
  ## 0.32.1
4
49
 
5
50
  ### 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-DqQwYYJ1.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-DqQwYYJ1.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-DqQwYYJ1.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-DqQwYYJ1.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,11 @@ 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 KunUI toolbar's popover, or the headless toolbar's native
53
+ * `window.prompt`. Gets the currently selected text (to prefill or search).
54
+ * Return the URL, or a falsy value to cancel. One override covers every link
55
+ * entry point.
56
56
  */
57
57
  type LinkPrompt = (context: {
58
58
  text: string;
@@ -69,8 +69,9 @@ interface KunEditorAdapters {
69
69
  stickerSource?: StickerSource;
70
70
  notify?: Notify;
71
71
  /**
72
- * Custom link-URL entry (replaces the native prompt in the headless toolbar /
73
- * bubble, and the KunUI toolbar's popover). See {@link LinkPrompt}.
72
+ * Custom link-URL entry (replaces the selection bubble's inline input, the
73
+ * headless toolbar's native prompt, and the KunUI toolbar's popover). See
74
+ * {@link LinkPrompt}.
74
75
  */
75
76
  linkPrompt?: LinkPrompt;
76
77
  /**
@@ -48,11 +48,11 @@ 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 KunUI toolbar's popover, or the headless toolbar's native
53
+ * `window.prompt`. Gets the currently selected text (to prefill or search).
54
+ * Return the URL, or a falsy value to cancel. One override covers every link
55
+ * entry point.
56
56
  */
57
57
  type LinkPrompt = (context: {
58
58
  text: string;
@@ -69,8 +69,9 @@ interface KunEditorAdapters {
69
69
  stickerSource?: StickerSource;
70
70
  notify?: Notify;
71
71
  /**
72
- * Custom link-URL entry (replaces the native prompt in the headless toolbar /
73
- * bubble, and the KunUI toolbar's popover). See {@link LinkPrompt}.
72
+ * Custom link-URL entry (replaces the selection bubble's inline input, the
73
+ * headless toolbar's native prompt, and the KunUI toolbar's popover). See
74
+ * {@link LinkPrompt}.
74
75
  */
75
76
  linkPrompt?: LinkPrompt;
76
77
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-core",
3
- "version": "0.32.1",
3
+ "version": "0.33.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": [