@kungal/editor-core 0.33.0 → 0.35.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.
@@ -49,10 +49,13 @@ 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
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.
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.
55
+ *
56
+ * The URL you return is normalized like any other (a schemeless host gets
57
+ * `https://`), so a picker can hand back whatever it has. See
58
+ * `normalizeLinkHref`.
56
59
  */
57
60
  type LinkPrompt = (context: {
58
61
  text: string;
@@ -70,7 +73,7 @@ interface KunEditorAdapters {
70
73
  notify?: Notify;
71
74
  /**
72
75
  * 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
76
+ * headless toolbar's URL panel, and the KunUI toolbar's popover). See
74
77
  * {@link LinkPrompt}.
75
78
  */
76
79
  linkPrompt?: LinkPrompt;
@@ -49,10 +49,13 @@ 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
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.
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.
55
+ *
56
+ * The URL you return is normalized like any other (a schemeless host gets
57
+ * `https://`), so a picker can hand back whatever it has. See
58
+ * `normalizeLinkHref`.
56
59
  */
57
60
  type LinkPrompt = (context: {
58
61
  text: string;
@@ -70,7 +73,7 @@ interface KunEditorAdapters {
70
73
  notify?: Notify;
71
74
  /**
72
75
  * 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
76
+ * headless toolbar's URL panel, and the KunUI toolbar's popover). See
74
77
  * {@link LinkPrompt}.
75
78
  */
76
79
  linkPrompt?: LinkPrompt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-core",
3
- "version": "0.33.0",
3
+ "version": "0.35.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": [
@@ -1,30 +0,0 @@
1
- // src/outline.ts
2
- var FENCE = /^\s{0,3}(?:```|~~~)/;
3
- var ATX = /^ {0,3}(#{1,6})\s+(.+?)\s*#*\s*$/;
4
- var parseHeadings = (markdown) => {
5
- const out = [];
6
- let inFence = false;
7
- for (const line of markdown.split("\n")) {
8
- if (FENCE.test(line)) {
9
- inFence = !inFence;
10
- continue;
11
- }
12
- if (inFence) {
13
- continue;
14
- }
15
- const m = line.match(ATX);
16
- if (m) {
17
- out.push({ level: m[1].length, text: m[2].trim() });
18
- }
19
- }
20
- return out;
21
- };
22
-
23
- // src/index.ts
24
- var MENTION_SCHEME = "kungal-user:";
25
- var QUOTE_SCHEME = "kungal-reply:";
26
- var KUN_EDITOR_CORE_VERSION = "0.0.0";
27
-
28
- export { KUN_EDITOR_CORE_VERSION, MENTION_SCHEME, QUOTE_SCHEME, parseHeadings };
29
- //# sourceMappingURL=chunk-PT42ZQGO.js.map
30
- //# sourceMappingURL=chunk-PT42ZQGO.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/outline.ts","../src/index.ts"],"names":[],"mappings":";AAgBA,IAAM,KAAA,GAAQ,qBAAA;AACd,IAAM,GAAA,GAAM,kCAAA;AAGL,IAAM,aAAA,GAAgB,CAAC,QAAA,KAAmC;AAC/D,EAAA,MAAM,MAAoB,EAAC;AAC3B,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,KAAA,MAAW,IAAA,IAAQ,QAAA,CAAS,KAAA,CAAM,IAAI,CAAA,EAAG;AACvC,IAAA,IAAI,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,EAAG;AACpB,MAAA,OAAA,GAAU,CAAC,OAAA;AACX,MAAA;AAAA,IACF;AACA,IAAA,IAAI,OAAA,EAAS;AACX,MAAA;AAAA,IACF;AACA,IAAA,MAAM,CAAA,GAAI,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AACxB,IAAA,IAAI,CAAA,EAAG;AACL,MAAA,GAAA,CAAI,IAAA,CAAK,EAAE,KAAA,EAAO,CAAA,CAAE,CAAC,CAAA,CAAG,MAAA,EAAQ,IAAA,EAAM,CAAA,CAAE,CAAC,CAAA,CAAG,IAAA,IAAQ,CAAA;AAAA,IACtD;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;;;ACtBO,IAAM,cAAA,GAAiB;AAMvB,IAAM,YAAA,GAAe;AAErB,IAAM,uBAAA,GAA0B","file":"chunk-PT42ZQGO.js","sourcesContent":["// Heading outline (table-of-contents) parsing — pure, zero-dep, so it lives in\n// the light main entry (a host, or the server, can build a TOC without pulling in\n// @milkdown/kit). Parses ATX headings (`#`…`######`) — what the toolbar produces\n// — and skips fenced code blocks so a `# comment` inside ``` isn't mistaken for a\n// heading. Setext headings (underlined) are intentionally not parsed.\n//\n// The result is an ordered list; a UI renders it and, on click, calls the\n// editor's `scrollToHeading(index)` with the item's array index.\n\nexport interface KunHeading {\n /** Heading level 1–6. */\n level: number\n /** The heading's text (trailing `#` closers stripped). */\n text: string\n}\n\nconst FENCE = /^\\s{0,3}(?:```|~~~)/\nconst ATX = /^ {0,3}(#{1,6})\\s+(.+?)\\s*#*\\s*$/\n\n/** Parse the ordered ATX-heading outline from a markdown string. */\nexport const parseHeadings = (markdown: string): KunHeading[] => {\n const out: KunHeading[] = []\n let inFence = false\n for (const line of markdown.split('\\n')) {\n if (FENCE.test(line)) {\n inFence = !inFence\n continue\n }\n if (inFence) {\n continue\n }\n const m = line.match(ATX)\n if (m) {\n out.push({ level: m[1]!.length, text: m[2]!.trim() })\n }\n }\n return out\n}\n","// @kungal/editor-core — public entry.\n//\n// STATUS: scaffold. The adapter contracts (the stable public surface) are\n// defined and exported now; the Milkdown plugin ports land incrementally per\n// docs/architecture.md § migration. Consumers should code against the types\n// below — those are the contract that will not churn as plugins move over.\n\nexport * from './types'\n\n// Heading outline (TOC) parsing — pure, so it's here in the light entry.\nexport * from './outline'\n\n// Markdown scheme used to encode an @mention as a plain link the server can\n// render + parse: `[@name](kungal-user:<id>)`. Lives here (not the plugin) so\n// hosts and the server can share the exact string. See ./plugins/mention.\nexport const MENTION_SCHEME = 'kungal-user:'\n\n// Markdown scheme for an inline reference (reply quote): `[label](kungal-reply:<refId>)`.\n// Like MENTION_SCHEME, shared with the server renderer so both agree on the\n// exact string. The reference is opaque here — the host decides what `refId` /\n// `label` mean (see docs/architecture.md § the reply-quote question, option 1).\nexport const QUOTE_SCHEME = 'kungal-reply:'\n\nexport const KUN_EDITOR_CORE_VERSION = '0.0.0'\n\n// ── The Milkdown plugins live in the `./preset` subpath ──────────────────────\n// This main entry stays light on purpose: types + MENTION_SCHEME, ZERO runtime\n// deps, so the server (which only needs the @mention scheme string) can import\n// it without installing @milkdown/kit / katex / codemirror.\n//\n// The composed Milkdown bundle and the individual plugin factories are exported\n// from `@kungal/editor-core/preset` (they pull in the peer deps):\n//\n// import { createKunEditorPlugins } from '@kungal/editor-core/preset'\n//\n// P1 landed (docs/architecture.md § migration): spoiler, katex, code-block,\n// stop-link — each a factory (createXxxPlugin), never a host-bound singleton.\n// P2 adds the adapter-driven plugins (upload / mention / sticker).\n"]}