From e8166d70c2a38a9afe97957038e9e23366b1ebe6 Mon Sep 17 00:00:00 2001 From: Ben Merckx Date: Fri, 13 Dec 2024 11:12:50 +0100 Subject: [PATCH] Fix pickChildren --- apps/dev/src/schema/Folder.tsx | 10 ++++------ src/picker/entry/EntryPicker.browser.tsx | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/dev/src/schema/Folder.tsx b/apps/dev/src/schema/Folder.tsx index e992359f..b56aac33 100644 --- a/apps/dev/src/schema/Folder.tsx +++ b/apps/dev/src/schema/Folder.tsx @@ -2,14 +2,12 @@ import {Config, Field} from 'alinea' import {Page} from './Page.js' import {LinkFields} from './example/LinkFields.js' -export const Folder = Config.type('Folder', { +export const Folder = Config.document('Folder', { contains: [Page, LinkFields], fields: { - title: Field.text('Title', { - width: 0.5 - }), - path: Field.path('Path', { - width: 0.5 + childrenLink: Field.entry('Pick children', { + help: `Show only children of the current entry`, + pickChildren: true }) } }) diff --git a/src/picker/entry/EntryPicker.browser.tsx b/src/picker/entry/EntryPicker.browser.tsx index f1ac9f3f..0de9ed12 100644 --- a/src/picker/entry/EntryPicker.browser.tsx +++ b/src/picker/entry/EntryPicker.browser.tsx @@ -147,7 +147,10 @@ export function EntryPickerModal({ { _workspace: destination.workspace, _root: destination.root, - _parentId: withNavigation ? destination.parentId ?? null : undefined, + _parentId: + withNavigation || pickChildren + ? destination.parentId ?? null + : undefined, _locale: destinationLocale } ]