@kungal/editor-core 0.27.0 → 0.29.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 +32 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/preset/index.d.cts +1 -1
- package/dist/preset/index.d.ts +1 -1
- package/dist/{types-Dq7UxR_g.d.cts → types-BazCkMGt.d.cts} +17 -1
- package/dist/{types-Dq7UxR_g.d.ts → types-BazCkMGt.d.ts} +17 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @kungal/editor-core
|
|
2
2
|
|
|
3
|
+
## 0.29.0
|
|
4
|
+
|
|
5
|
+
## 0.28.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- 8d278e5: Make the insert-link URL entry customizable via a `linkPrompt` adapter.
|
|
10
|
+
|
|
11
|
+
The headless toolbar and the selection bubble asked for the link URL with the
|
|
12
|
+
native `window.prompt` (the KunUI toolbar used an inline popover). Hosts can now
|
|
13
|
+
supply their own UI instead — a modal, an article picker, etc.:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const adapters = {
|
|
17
|
+
// …uploadImage, notify…
|
|
18
|
+
linkPrompt: async ({ text }) => await openLinkModal(text), // return the URL, or null to cancel
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **editor-core**: new `LinkPrompt` type + `linkPrompt?` on `KunEditorAdapters`.
|
|
23
|
+
It receives the selected text (to prefill / search).
|
|
24
|
+
- **editor-vue**: the default toolbar and the selection bubble use `linkPrompt`
|
|
25
|
+
when supplied, else fall back to `window.prompt`.
|
|
26
|
+
- **editor-nuxt**: when `linkPrompt` is set, `<KunEditorToolbar>`'s link button
|
|
27
|
+
uses it instead of its inline popover — so one override covers every link entry
|
|
28
|
+
point (toolbar, default toolbar, bubble).
|
|
29
|
+
|
|
30
|
+
Verified in the docs production build: with a `linkPrompt` that derives a URL from
|
|
31
|
+
the selected text, the selection bubble inserts
|
|
32
|
+
`[…](https://example.com/search?q=…)` with no native dialog, and the KunUI
|
|
33
|
+
toolbar link becomes a plain button (no popover); 0 console errors.
|
|
34
|
+
|
|
3
35
|
## 0.27.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { K as KunEditorAdapters, a as KunEditorFeatures, b as KunEditorLocale, 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-
|
|
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';
|
|
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, 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-
|
|
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';
|
|
2
2
|
|
|
3
3
|
interface KunHeading {
|
|
4
4
|
/** Heading level 1–6. */
|
package/dist/preset/index.d.cts
CHANGED
|
@@ -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-
|
|
3
|
+
import { b as KunEditorLocale, N as Notify, U as UploadImage, K as KunEditorAdapters, a as KunEditorFeatures } from '../types-BazCkMGt.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';
|
package/dist/preset/index.d.ts
CHANGED
|
@@ -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-
|
|
3
|
+
import { b as KunEditorLocale, N as Notify, U as UploadImage, K as KunEditorAdapters, a as KunEditorFeatures } from '../types-BazCkMGt.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';
|
|
@@ -46,6 +46,17 @@ type NotifyLevel = 'info' | 'success' | 'warn' | 'error';
|
|
|
46
46
|
* Forum today: `useMessage(code, level)`.
|
|
47
47
|
*/
|
|
48
48
|
type Notify = (message: string, level: NotifyLevel) => void;
|
|
49
|
+
/**
|
|
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.
|
|
56
|
+
*/
|
|
57
|
+
type LinkPrompt = (context: {
|
|
58
|
+
text: string;
|
|
59
|
+
}) => string | null | undefined | Promise<string | null | undefined>;
|
|
49
60
|
/**
|
|
50
61
|
* The full policy bundle a host passes when constructing the editor. Every
|
|
51
62
|
* field is optional: omit `uploadImage` for an image-free editor (the galgame
|
|
@@ -57,6 +68,11 @@ interface KunEditorAdapters {
|
|
|
57
68
|
searchMentionUsers?: SearchMentionUsers;
|
|
58
69
|
stickerSource?: StickerSource;
|
|
59
70
|
notify?: Notify;
|
|
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}.
|
|
74
|
+
*/
|
|
75
|
+
linkPrompt?: LinkPrompt;
|
|
60
76
|
/**
|
|
61
77
|
* How an @mention's user id becomes its markdown link URL. The URL form is a
|
|
62
78
|
* server contract, so it's host policy — default `kungal-user:<id>` (the KUN
|
|
@@ -102,4 +118,4 @@ interface KunEditorFeatures {
|
|
|
102
118
|
sticker?: boolean;
|
|
103
119
|
}
|
|
104
120
|
|
|
105
|
-
export type { KunEditorAdapters as K, MentionUser as M, Notify as N, SearchMentionUsers as S, UploadImage as U, KunEditorFeatures as a, KunEditorLocale as b, NotifyLevel as c, StickerItem as d, StickerPack as e, StickerSource as f };
|
|
121
|
+
export type { KunEditorAdapters as K, LinkPrompt as L, MentionUser as M, Notify as N, SearchMentionUsers as S, UploadImage as U, KunEditorFeatures as a, KunEditorLocale as b, NotifyLevel as c, StickerItem as d, StickerPack as e, StickerSource as f };
|
|
@@ -46,6 +46,17 @@ type NotifyLevel = 'info' | 'success' | 'warn' | 'error';
|
|
|
46
46
|
* Forum today: `useMessage(code, level)`.
|
|
47
47
|
*/
|
|
48
48
|
type Notify = (message: string, level: NotifyLevel) => void;
|
|
49
|
+
/**
|
|
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.
|
|
56
|
+
*/
|
|
57
|
+
type LinkPrompt = (context: {
|
|
58
|
+
text: string;
|
|
59
|
+
}) => string | null | undefined | Promise<string | null | undefined>;
|
|
49
60
|
/**
|
|
50
61
|
* The full policy bundle a host passes when constructing the editor. Every
|
|
51
62
|
* field is optional: omit `uploadImage` for an image-free editor (the galgame
|
|
@@ -57,6 +68,11 @@ interface KunEditorAdapters {
|
|
|
57
68
|
searchMentionUsers?: SearchMentionUsers;
|
|
58
69
|
stickerSource?: StickerSource;
|
|
59
70
|
notify?: Notify;
|
|
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}.
|
|
74
|
+
*/
|
|
75
|
+
linkPrompt?: LinkPrompt;
|
|
60
76
|
/**
|
|
61
77
|
* How an @mention's user id becomes its markdown link URL. The URL form is a
|
|
62
78
|
* server contract, so it's host policy — default `kungal-user:<id>` (the KUN
|
|
@@ -102,4 +118,4 @@ interface KunEditorFeatures {
|
|
|
102
118
|
sticker?: boolean;
|
|
103
119
|
}
|
|
104
120
|
|
|
105
|
-
export type { KunEditorAdapters as K, MentionUser as M, Notify as N, SearchMentionUsers as S, UploadImage as U, KunEditorFeatures as a, KunEditorLocale as b, NotifyLevel as c, StickerItem as d, StickerPack as e, StickerSource as f };
|
|
121
|
+
export type { KunEditorAdapters as K, LinkPrompt as L, MentionUser as M, Notify as N, SearchMentionUsers as S, UploadImage as U, KunEditorFeatures as a, KunEditorLocale as b, NotifyLevel as c, StickerItem as d, StickerPack as e, StickerSource as f };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungal/editor-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.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": [
|