Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core/form): add block and annotation component schema extens…
…ions Object types can now be rendered as .block or .annotation in the PT-input through their Studio schema extension
- Loading branch information
1 parent
acc0e79
commit bbd32ae
Showing
5 changed files
with
125 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {Path, PortableTextBlock, PortableTextObject, PortableTextTextBlock} from '@sanity/types' | ||
|
||
/** @alpha */ | ||
export interface BlockDecoratorProps { | ||
children: React.ReactElement | ||
focused: boolean | ||
renderDefault: (props: BlockDecoratorProps) => React.ReactElement | ||
selected: boolean | ||
title: string | ||
value: string | ||
} | ||
|
||
/** @alpha */ | ||
export interface BlockStyleProps { | ||
block: PortableTextTextBlock | ||
children: React.ReactElement | ||
focused: boolean | ||
renderDefault: (props: BlockStyleProps) => React.ReactElement | ||
selected: boolean | ||
title: string | ||
value: string | ||
} | ||
|
||
/** @alpha */ | ||
export interface BlockListItemProps { | ||
block: PortableTextTextBlock | ||
children: React.ReactElement | ||
focused: boolean | ||
level: number | ||
renderDefault: (props: BlockListItemProps) => React.ReactElement | ||
selected: boolean | ||
title: string | ||
value: string | ||
} | ||
|
||
/** @alpha */ | ||
export interface BlockAnnotationProps { | ||
children: React.ReactElement | ||
focused: boolean | ||
onClose: () => void | ||
onOpen: () => void | ||
onRemove: () => void | ||
open: boolean | ||
path: Path | ||
renderDefault: (props: BlockAnnotationProps) => React.ReactElement | ||
selected: boolean | ||
value: PortableTextObject | ||
} | ||
|
||
/** @alpha */ | ||
export interface BlockProps { | ||
children: React.ReactElement | ||
focused: boolean | ||
onClose: () => void | ||
onOpen: () => void | ||
onRemove: () => void | ||
open: boolean | ||
path: Path | ||
renderDefault: (props: BlockProps) => React.ReactElement | ||
selected: boolean | ||
value: PortableTextBlock | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters