Skip to content

Commit

Permalink
Default the document editor demo on the website to be expanded (keyst…
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown authored Oct 21, 2022
1 parent 916703a commit f01eda2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/components/docs/DocumentEditorDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ export const DocumentEditorDemo = () => {
css={{
marginTop: 'var(--space-xlarge)',
marginBottom: 'var(--space-xlarge)',
borderBottom: `1px var(--border) solid`,
}}
>
<DocumentEditor
Expand All @@ -337,6 +336,7 @@ export const DocumentEditorDemo = () => {
componentBlocks={componentBlocks}
documentFeatures={documentFeatures}
relationships={emptyObj}
initialExpanded
/>
</div>
<details css={{ marginBottom: 'var(--space-xlarge)' }}>
Expand Down
4 changes: 3 additions & 1 deletion packages/fields-document/src/DocumentEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ export function DocumentEditor({
componentBlocks,
relationships,
documentFeatures,
initialExpanded = false,
...props
}: {
onChange: undefined | ((value: Descendant[]) => void);
value: Descendant[];
componentBlocks: Record<string, ComponentBlock>;
relationships: Relationships;
documentFeatures: DocumentFeatures;
initialExpanded?: boolean;
} & Omit<EditableProps, 'value' | 'onChange'>) {
const { radii, colors, spacing, fields } = useTheme();
const [expanded, setExpanded] = useState(false);
const [expanded, setExpanded] = useState(initialExpanded);
const editor = useMemo(
() => createDocumentEditor(documentFeatures, componentBlocks, relationships),
[documentFeatures, componentBlocks, relationships]
Expand Down

0 comments on commit f01eda2

Please sign in to comment.