@kidecms/core 0.28.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.
@@ -222,20 +222,22 @@ function BlockNodeView(props: NodeViewProps) {
222
222
  )}
223
223
 
224
224
  <div className="ml-auto flex shrink-0 items-center">
225
- <Button
226
- type="button"
227
- variant="ghost"
228
- size="icon"
229
- title={isShared ? "Detach shared section" : "Save as shared section"}
230
- className="text-muted-foreground hover:text-foreground size-7"
231
- onClick={(e) => {
232
- e.stopPropagation();
233
- if (isShared) detach();
234
- else openSaveDialog();
235
- }}
236
- >
237
- {isShared ? <Unlink className="size-3.5" /> : <Save className="size-3.5" />}
238
- </Button>
225
+ {(isShared || options.sharedEnabled) && (
226
+ <Button
227
+ type="button"
228
+ variant="ghost"
229
+ size="icon"
230
+ title={isShared ? "Detach shared section" : "Save as shared section"}
231
+ className="text-muted-foreground hover:text-foreground size-7"
232
+ onClick={(e) => {
233
+ e.stopPropagation();
234
+ if (isShared) detach();
235
+ else openSaveDialog();
236
+ }}
237
+ >
238
+ {isShared ? <Unlink className="size-3.5" /> : <Save className="size-3.5" />}
239
+ </Button>
240
+ )}
239
241
  <Button
240
242
  type="button"
241
243
  variant="ghost"
@@ -380,6 +382,8 @@ type Props = {
380
382
  linkOptions?: LinkableCollection[];
381
383
  /** Shared sections offered by the `/` menu. */
382
384
  sharedSections?: SharedSectionOption[];
385
+ /** Whether shared sections exist as a collection at all (see FieldControl). */
386
+ sharedEnabled?: boolean;
383
387
  /** When true, show a button that expands the editor into a fullscreen overlay. */
384
388
  fullscreen?: boolean;
385
389
  };
@@ -398,6 +402,7 @@ export default function ContentEditor({
398
402
  types,
399
403
  linkOptions = [],
400
404
  sharedSections = [],
405
+ sharedEnabled = false,
401
406
  fullscreen = false,
402
407
  }: Props) {
403
408
  const hiddenRef = useRef<HTMLInputElement>(null);
@@ -488,7 +493,7 @@ export default function ContentEditor({
488
493
  showOnlyCurrent: true,
489
494
  placeholder: ({ node }) => (node.type.name === "paragraph" ? "Type / for commands…" : ""),
490
495
  }),
491
- BlockNode.configure({ types, linkOptions, fieldName: name }),
496
+ BlockNode.configure({ types, linkOptions, fieldName: name, sharedEnabled }),
492
497
  SlashCommand.configure({ types, sharedSections, onInsertImage: () => setImageBrowseOpen(true) }),
493
498
  ],
494
499
  content: contentToTiptap(parsedInitial),
@@ -54,6 +54,7 @@ const {
54
54
  linkableCollections = [],
55
55
  sharedBlockTypes = {},
56
56
  sharedSectionOptions = [],
57
+ sharedSectionsAvailable = false,
57
58
  } = Astro.props as {
58
59
  name: string;
59
60
  field: FieldConfig;
@@ -64,6 +65,9 @@ const {
64
65
  linkableCollections?: LinkableCollection[];
65
66
  sharedBlockTypes?: Record<string, Record<string, FieldConfig>>;
66
67
  sharedSectionOptions?: SharedSectionOption[];
68
+ /** False when the project registers no `shared-sections` collection (or the
69
+ * user may not write to it) — the save-as-shared action stays hidden. */
70
+ sharedSectionsAvailable?: boolean;
67
71
  };
68
72
 
69
73
  const label = field.label ?? humanize(name);
@@ -334,6 +338,7 @@ const sharedBlockTypesMeta = toBlockTypesMeta(sharedBlockTypes);
334
338
  types={blockTypesMeta}
335
339
  linkOptions={linkableCollections}
336
340
  sharedSections={sharedSectionOptions}
341
+ sharedEnabled={sharedSectionsAvailable}
337
342
  fullscreen={field.fullscreen !== false}
338
343
  />
339
344
  )}
@@ -412,7 +417,7 @@ const sharedBlockTypesMeta = toBlockTypesMeta(sharedBlockTypes);
412
417
  types={blockTypesMeta}
413
418
  linkOptions={linkableCollections}
414
419
  sharedSections={"shared" in field && field.shared === false ? [] : sharedSectionOptions}
415
- sharedEnabled={!("shared" in field && field.shared === false)}
420
+ sharedEnabled={sharedSectionsAvailable && !("shared" in field && field.shared === false)}
416
421
  />
417
422
  )}
418
423
 
@@ -8,12 +8,14 @@ import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectVa
8
8
  import InternalLinkPicker, { type LinkableCollection } from "./InternalLinkPicker";
9
9
 
10
10
  // A structured link control: URL + label + open-in-new-tab, stored as
11
- // { type, url, label, title, newTab, docId, collection }. A leading "/" is
12
- // treated as an internal link. When linkable collections are provided, internal
13
- // links are chosen with a document picker; the pick stores the document
14
- // reference (docId + collection) so renderers can resolve the current route via
15
- // resolveLinkUrl(), with `url` kept as a cached fallback. `title` is the picked
16
- // document's title — renderers use it as the link text when `label` is left empty.
11
+ // { type, url, label, title, newTab, docId, collection }. `type` is the editor
12
+ // mode the value was authored in and is stored, never re-guessed from the URL:
13
+ // "reference" is a document picked from a linkable collection (docId +
14
+ // collection, so renderers resolve the current route via resolveLinkUrl() and
15
+ // the link survives slug edits, with `url` kept as a cached fallback), "custom"
16
+ // is a hand-written URL — a site path or an absolute URL, both fine. `title` is
17
+ // the picked document's title — renderers use it as the link text when `label`
18
+ // is left empty.
17
19
  type LinkValue = {
18
20
  type?: string;
19
21
  url?: string;
@@ -24,6 +26,17 @@ type LinkValue = {
24
26
  collection?: string;
25
27
  };
26
28
 
29
+ type LinkMode = "reference" | "custom";
30
+
31
+ /** Legacy values (and seeds) predate the stored mode: a document reference is
32
+ * one that actually carries a document, everything else is a custom URL. */
33
+ function modeOf(value: LinkValue, hasPicker: boolean): LinkMode {
34
+ if (value.type === "reference" || value.type === "custom") return value.type;
35
+ if (value.docId && value.collection) return "reference";
36
+ if (value.url) return "custom";
37
+ return hasPicker ? "reference" : "custom";
38
+ }
39
+
27
40
  type Props = {
28
41
  name?: string;
29
42
  value?: string | LinkValue;
@@ -46,12 +59,9 @@ function parse(v: unknown): LinkValue {
46
59
  }
47
60
 
48
61
  export default function LinkField({ name, value: initial, onChange, linkOptions = [] }: Props) {
62
+ const hasPicker = linkOptions.length > 0;
49
63
  const [value, setValue] = useState<LinkValue>(parse(initial));
50
- const [linkType, setLinkType] = useState<"internal" | "external">(() => {
51
- const url = parse(initial).url ?? "";
52
- if (url) return url.startsWith("/") ? "internal" : "external";
53
- return linkOptions.length > 0 ? "internal" : "external";
54
- });
64
+ const [mode, setMode] = useState<LinkMode>(() => modeOf(parse(initial), hasPicker));
55
65
  const hiddenRef = useRef<HTMLInputElement>(null);
56
66
  const isInitial = useRef(true);
57
67
 
@@ -63,14 +73,19 @@ export default function LinkField({ name, value: initial, onChange, linkOptions
63
73
  hiddenRef.current?.dispatchEvent(new Event("change", { bubbles: true }));
64
74
  }, [value]);
65
75
 
66
- const set = (patch: Partial<LinkValue>) => {
67
- const next: LinkValue = { ...value, ...patch };
68
- if (next.url) next.type = next.url.startsWith("/") ? "internal" : "external";
76
+ const set = (patch: Partial<LinkValue>, nextMode: LinkMode = mode) => {
77
+ const next: LinkValue = { ...value, ...patch, type: nextMode };
69
78
  setValue(next);
70
79
  onChange?.(next);
71
80
  };
72
81
 
73
- const hasPicker = linkOptions.length > 0;
82
+ // Switching modes drops what the other mode owns: a custom URL keeps its text
83
+ // as a starting point, a document pick starts from an empty picker.
84
+ const changeMode = (next: LinkMode) => {
85
+ setMode(next);
86
+ if (next === "custom") set({ title: undefined, docId: undefined, collection: undefined }, next);
87
+ else set({ url: "", title: undefined, docId: undefined, collection: undefined }, next);
88
+ };
74
89
 
75
90
  return (
76
91
  <div className="space-y-2 rounded-md border p-3">
@@ -82,23 +97,23 @@ export default function LinkField({ name, value: initial, onChange, linkOptions
82
97
  <div className="flex min-w-0 items-center gap-2">
83
98
  <Select
84
99
  items={[
85
- { value: "internal", label: "Internal" },
86
- { value: "external", label: "External" },
100
+ { value: "reference", label: "Choose page" },
101
+ { value: "custom", label: "Type URL" },
87
102
  ]}
88
- value={linkType}
89
- onValueChange={(v) => setLinkType((v as "internal" | "external") ?? "internal")}
103
+ value={mode}
104
+ onValueChange={(v) => changeMode((v as LinkMode) ?? "reference")}
90
105
  >
91
- <SelectTrigger className="w-28 shrink-0 text-sm">
106
+ <SelectTrigger className="w-36 shrink-0 text-sm">
92
107
  <SelectValue />
93
108
  </SelectTrigger>
94
109
  <SelectContent>
95
110
  <SelectGroup>
96
- <SelectItem value="internal">Internal</SelectItem>
97
- <SelectItem value="external">External</SelectItem>
111
+ <SelectItem value="reference">Choose page</SelectItem>
112
+ <SelectItem value="custom">Type URL</SelectItem>
98
113
  </SelectGroup>
99
114
  </SelectContent>
100
115
  </Select>
101
- {linkType === "internal" ? (
116
+ {mode === "reference" ? (
102
117
  <InternalLinkPicker
103
118
  editHref={value.url ?? ""}
104
119
  editTitle={value.title}
@@ -110,7 +125,7 @@ export default function LinkField({ name, value: initial, onChange, linkOptions
110
125
  ) : (
111
126
  <Input
112
127
  value={value.url ?? ""}
113
- placeholder="https://example.com"
128
+ placeholder="https://example.com or /contact"
114
129
  onChange={(e) =>
115
130
  set({ url: e.target.value, title: undefined, docId: undefined, collection: undefined })
116
131
  }
@@ -120,7 +135,7 @@ export default function LinkField({ name, value: initial, onChange, linkOptions
120
135
  ) : (
121
136
  <Input
122
137
  value={value.url ?? ""}
123
- placeholder="https://example.com or /about"
138
+ placeholder="https://example.com or /contact"
124
139
  onChange={(e) => set({ url: e.target.value, title: undefined, docId: undefined, collection: undefined })}
125
140
  />
126
141
  )}
@@ -46,17 +46,23 @@ import {
46
46
  canIndent,
47
47
  canOutdent,
48
48
  canAddChild,
49
+ collectSlugs,
50
+ uniqueSlug,
49
51
  MENU_MAX_DEPTH,
50
52
  } from "./tree-utils";
51
53
 
52
54
  // --- Types ---
53
55
 
56
+ /** How a menu item's href was authored — stored on the item so a hand-written
57
+ * path is never mistaken for a document that was picked. */
58
+ type LinkMode = "reference" | "custom";
59
+
54
60
  type EditState = {
55
61
  id: string;
56
62
  label: string;
57
63
  href: string;
58
64
  target: string;
59
- linkType: "external" | "internal";
65
+ linkType: LinkMode;
60
66
  name: string;
61
67
  slug: string;
62
68
  autoSlug: boolean;
@@ -71,7 +77,13 @@ type Props = {
71
77
  };
72
78
 
73
79
  function blankEdit(id: string): EditState {
74
- return { id, label: "", href: "", target: "", linkType: "internal", name: "", slug: "", autoSlug: true };
80
+ return { id, label: "", href: "", target: "", linkType: "reference", name: "", slug: "", autoSlug: true };
81
+ }
82
+
83
+ /** The slug a pending edit will be saved with: slugified, and made unique
84
+ * against the rest of the tree. */
85
+ function commitSlug(state: EditState, taken: Set<string>): string {
86
+ return uniqueSlug(slugify(state.slug || state.name), taken);
75
87
  }
76
88
 
77
89
  function flattenForSelect(list: TreeItem[], depth = 0): Array<{ id: string; label: string }> {
@@ -127,6 +139,11 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
127
139
 
128
140
  const updateEditing = (patch: Partial<EditState>) => setEditing((prev) => (prev ? { ...prev, ...patch } : prev));
129
141
 
142
+ // Term slugs identify the term in document data, so they must stay unique
143
+ // across the whole tree — a collision is resolved with a `-2` suffix.
144
+ const takenSlugs = React.useMemo(() => collectSlugs(items, editing?.id), [items, editing?.id]);
145
+ const slugCollides = !!editing && !editing.autoSlug && takenSlugs.has(slugify(editing.slug));
146
+
130
147
  const [expandedIds, setExpandedIds] = React.useState<Set<string>>(() => {
131
148
  const ids = new Set<string>();
132
149
  const collectIds = (list: TreeItem[]) => {
@@ -150,9 +167,10 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
150
167
  item.label = editing.label;
151
168
  item.href = editing.href;
152
169
  item.target = editing.target || undefined;
170
+ item.linkType = editing.linkType;
153
171
  } else {
154
172
  item.name = editing.name;
155
- item.slug = editing.slug || slugify(editing.name);
173
+ item.slug = commitSlug(editing, takenSlugs);
156
174
  }
157
175
  return;
158
176
  }
@@ -161,7 +179,7 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
161
179
  };
162
180
  apply(merged);
163
181
  return JSON.stringify(merged);
164
- }, [items, editing, variant]);
182
+ }, [items, editing, variant, takenSlugs]);
165
183
 
166
184
  // Notify form of changes so UnsavedGuard can detect them
167
185
  React.useEffect(() => {
@@ -226,9 +244,10 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
226
244
  item.label = editing.label;
227
245
  item.href = editing.href;
228
246
  item.target = editing.target || undefined;
247
+ item.linkType = editing.linkType;
229
248
  } else {
230
249
  item.name = editing.name;
231
- item.slug = editing.slug || slugify(editing.name);
250
+ item.slug = commitSlug(editing, takenSlugs);
232
251
  }
233
252
  return;
234
253
  }
@@ -298,13 +317,14 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
298
317
 
299
318
  const startEdit = (item: TreeItem) => {
300
319
  if (variant === "menu") {
301
- const isInternal = String(item.href ?? "").startsWith("/");
302
320
  setEditing({
303
321
  ...blankEdit(item.id),
304
322
  label: String(item.label ?? ""),
305
323
  href: String(item.href ?? ""),
306
324
  target: String(item.target ?? ""),
307
- linkType: isInternal ? "internal" : "external",
325
+ // Items saved before the mode was stored carry only an href, which is
326
+ // exactly what a custom URL is.
327
+ linkType: item.linkType === "reference" ? "reference" : "custom",
308
328
  });
309
329
  } else {
310
330
  setEditing({
@@ -440,13 +460,13 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
440
460
  />
441
461
  <Select
442
462
  items={[
443
- { value: "external", label: "External link" },
444
- { value: "internal", label: "Internal link" },
463
+ { value: "reference", label: "Choose page" },
464
+ { value: "custom", label: "Type URL" },
445
465
  ]}
446
466
  value={editing.linkType}
447
467
  onValueChange={(v) => {
448
- const newType = (v as "external" | "internal") ?? "external";
449
- updateEditing({ linkType: newType, ...(newType === "internal" ? { href: "" } : {}) });
468
+ const newType = (v as LinkMode) ?? "reference";
469
+ updateEditing({ linkType: newType, ...(newType === "reference" ? { href: "" } : {}) });
450
470
  }}
451
471
  >
452
472
  <SelectTrigger className="bg-background h-7! min-w-0 flex-2 text-sm">
@@ -454,16 +474,16 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
454
474
  </SelectTrigger>
455
475
  <SelectContent>
456
476
  <SelectGroup>
457
- <SelectItem value="external">External link</SelectItem>
458
- <SelectItem value="internal">Internal link</SelectItem>
477
+ <SelectItem value="reference">Choose page</SelectItem>
478
+ <SelectItem value="custom">Type URL</SelectItem>
459
479
  </SelectGroup>
460
480
  </SelectContent>
461
481
  </Select>
462
- {editing.linkType === "external" ? (
482
+ {editing.linkType === "custom" ? (
463
483
  <Input
464
484
  value={editing.href}
465
485
  onChange={(e) => updateEditing({ href: e.target.value })}
466
- placeholder="https://..."
486
+ placeholder="https://example.com or /contact"
467
487
  className="bg-background h-7 min-w-0 flex-3 text-sm"
468
488
  onKeyDown={editKeyHandler}
469
489
  />
@@ -487,7 +507,7 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
487
507
  value={editing.name}
488
508
  onChange={(e) => {
489
509
  const name = e.target.value;
490
- updateEditing({ name, ...(editing.autoSlug ? { slug: slugify(name) } : {}) });
510
+ updateEditing({ name, ...(editing.autoSlug ? { slug: uniqueSlug(slugify(name), takenSlugs) } : {}) });
491
511
  }}
492
512
  placeholder="Name"
493
513
  className="bg-background h-7 flex-1 text-sm"
@@ -498,7 +518,12 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
498
518
  value={editing.slug}
499
519
  onChange={(e) => updateEditing({ slug: e.target.value, autoSlug: false })}
500
520
  placeholder="slug"
501
- className="bg-background h-7 w-36 text-sm"
521
+ title={
522
+ slugCollides
523
+ ? `Slug already used — this term will be saved as "${commitSlug(editing, takenSlugs)}".`
524
+ : undefined
525
+ }
526
+ className={cn("bg-background h-7 w-36 text-sm", slugCollides && "border-destructive text-destructive")}
502
527
  onKeyDown={editKeyHandler}
503
528
  />
504
529
  </>
@@ -650,12 +675,12 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
650
675
  .filter(Boolean);
651
676
  if (names.length === 0) return;
652
677
 
653
- const newItems = names.map((n) => ({
654
- id: generateId(),
655
- name: n,
656
- slug: slugify(n),
657
- children: [] as TreeItem[],
658
- }));
678
+ const taken = collectSlugs(items);
679
+ const newItems = names.map((n) => {
680
+ const slug = uniqueSlug(slugify(n), taken);
681
+ taken.add(slug);
682
+ return { id: generateId(), name: n, slug, children: [] as TreeItem[] };
683
+ });
659
684
 
660
685
  setItems((prev) => {
661
686
  const next = cloneItems(prev);
@@ -26,6 +26,9 @@ export type BlockNodeOptions = {
26
26
  linkOptions?: LinkableCollection[];
27
27
  /** Name of the `content` field this editor belongs to — namespaces sub-field DOM ids. */
28
28
  fieldName: string;
29
+ /** False when the project registers no `shared-sections` collection — the
30
+ * save-as-shared action is hidden rather than failing on POST. */
31
+ sharedEnabled?: boolean;
29
32
  };
30
33
 
31
34
  export const blockNodeSpec = {
@@ -109,3 +109,25 @@ export function canAddChild(items: TreeItem[], id: string, maxDepth?: number): b
109
109
  if (maxDepth === undefined) return true;
110
110
  return findItemDepth(items, id) < maxDepth;
111
111
  }
112
+
113
+ /** Slugs used elsewhere in the tree. A term slug is what documents store
114
+ * (`taxonomy-select`), so two terms sharing one are indistinguishable. */
115
+ export function collectSlugs(items: TreeItem[], excludeId?: string): Set<string> {
116
+ const slugs = new Set<string>();
117
+ const walk = (list: TreeItem[]) => {
118
+ for (const item of list) {
119
+ if (item.id !== excludeId && typeof item.slug === "string" && item.slug) slugs.add(item.slug);
120
+ walk(item.children);
121
+ }
122
+ };
123
+ walk(items);
124
+ return slugs;
125
+ }
126
+
127
+ /** `base`, or the first free `base-2`, `base-3`, … */
128
+ export function uniqueSlug(base: string, taken: Set<string>): string {
129
+ if (!base || !taken.has(base)) return base;
130
+ let suffix = 2;
131
+ while (taken.has(`${base}-${suffix}`)) suffix += 1;
132
+ return `${base}-${suffix}`;
133
+ }
@@ -4,7 +4,7 @@ import {
4
4
  getLabelField,
5
5
  type SharedSectionOption,
6
6
  } from "../../core";
7
- import { canRead } from "./access";
7
+ import { canRead, canWrite } from "./access";
8
8
 
9
9
  type User = { id: string; role?: string; email?: string } | null | undefined;
10
10
  type CmsRuntime = Record<string, any> & { meta: { getRouteForDocument: (slug: string, doc: any) => string } };
@@ -136,6 +136,14 @@ export const loadRelationOptionList = async (
136
136
  }));
137
137
  };
138
138
 
139
+ /** Whether the save-as-shared-section action should be offered at all: the
140
+ * project has to register a `shared-sections` collection, and the editor has to
141
+ * be allowed to write to it. Without this the action is a button that 404s. */
142
+ export function canUseSharedSections(config: any, user: User): boolean {
143
+ if (!config.collections.some((c: any) => c.slug === SHARED_SECTIONS_COLLECTION)) return false;
144
+ return canWrite(config, user, SHARED_SECTIONS_COLLECTION);
145
+ }
146
+
139
147
  export async function loadSharedSectionOptions(
140
148
  config: any,
141
149
  user: User,
@@ -254,6 +262,7 @@ export function loadLinkableCollections(config: any, user: User): LinkableCollec
254
262
  return config.collections
255
263
  .filter(
256
264
  (c: any) =>
265
+ c.linkable !== false &&
257
266
  !c.singleton &&
258
267
  !["users", "menus", "taxonomies", "authors"].includes(c.slug) &&
259
268
  c.fields.slug &&
@@ -34,6 +34,7 @@ import {
34
34
  import {
35
35
  loadDocument,
36
36
  loadLinkableCollections,
37
+ canUseSharedSections,
37
38
  loadParentFormTitle,
38
39
  loadRelationLabels,
39
40
  loadRelationMeta,
@@ -117,6 +118,7 @@ const relationLabelsByField = await loadRelationLabels(
117
118
  );
118
119
  const sharedBlockTypes = getSharedBlockTypes(config);
119
120
  const sharedSectionOptions = await loadSharedSectionOptions(config, user, cmsRuntime, defaultLocale, runtimeContext);
121
+ const sharedSectionsAvailable = canUseSharedSections(config, user);
120
122
  // Menu trees and any link field (standalone or inside blocks) share the same
121
123
  // internal-document picker; it searches these collections on the server.
122
124
  const linkableCollections = loadLinkableCollections(config, user);
@@ -518,6 +520,7 @@ const publishBlocked =
518
520
  linkableCollections={linkableCollections}
519
521
  sharedBlockTypes={sharedBlockTypes}
520
522
  sharedSectionOptions={sharedSectionOptions}
523
+ sharedSectionsAvailable={sharedSectionsAvailable}
521
524
  />
522
525
  );
523
526
  const fields = (
@@ -590,6 +593,7 @@ const publishBlocked =
590
593
  linkableCollections={linkableCollections}
591
594
  sharedBlockTypes={sharedBlockTypes}
592
595
  sharedSectionOptions={sharedSectionOptions}
596
+ sharedSectionsAvailable={sharedSectionsAvailable}
593
597
  />
594
598
  {aiEnabled && fieldName === "seoDescription" && !isFieldReadOnly(fieldName) && (
595
599
  <div class="mt-1.5">
@@ -717,6 +721,7 @@ const publishBlocked =
717
721
  linkableCollections={linkableCollections}
718
722
  sharedBlockTypes={sharedBlockTypes}
719
723
  sharedSectionOptions={sharedSectionOptions}
724
+ sharedSectionsAvailable={sharedSectionsAvailable}
720
725
  />
721
726
  {aiEnabled &&
722
727
  sourceText &&
package/core/define.ts CHANGED
@@ -200,6 +200,10 @@ export type CollectionConfig = {
200
200
  labelField?: string;
201
201
  pathPrefix?: string;
202
202
  preview?: boolean | string;
203
+ /** Whether documents may be picked as internal link targets in the admin.
204
+ * Defaults to true for non-singleton collections with a `slug` field; set
205
+ * false for slugged collections that have no public page of their own. */
206
+ linkable?: boolean;
203
207
  timestamps?: boolean;
204
208
  drafts?: boolean;
205
209
  versions?: { max: number };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kidecms/core",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Kide CMS runtime — core library, admin UI, routes, and middleware for Astro. Shipped as TypeScript source.",
5
5
  "keywords": [
6
6
  "cms",