Skip to content

Commit

Permalink
feat(react-tinacms-inline): block components are given their name
Browse files Browse the repository at this point in the history
fixes #1536
  • Loading branch information
ncphillips committed Oct 8, 2020
1 parent bf82807 commit 8d42e9a
Showing 1 changed file with 1 addition and 7 deletions.
Expand Up @@ -65,8 +65,6 @@ export interface InlineBlocksActions {
blocks: {
[key: string]: Block
}
activeBlock: number | null
setActiveBlock: any
direction: 'vertical' | 'horizontal'
min?: number
max?: number
Expand Down Expand Up @@ -97,7 +95,6 @@ export function InlineBlocks({
components = {},
}: InlineBlocksProps) {
const cms = useCMS()
const [activeBlock, setActiveBlock] = useState(-1)
const { setFocussedField } = useInlineForm()

return (
Expand All @@ -108,7 +105,6 @@ export function InlineBlocks({

const move = (from: number, to: number) => {
const movement = to - from
setActiveBlock(activeBlock => activeBlock + movement)
form.mutators.move(name, from, to)
setFocussedField(`${name}.${to}`)
}
Expand Down Expand Up @@ -147,8 +143,6 @@ export function InlineBlocks({
remove,
blocks,
count: allData.length,
activeBlock,
setActiveBlock,
direction,
min,
max,
Expand Down Expand Up @@ -221,7 +215,7 @@ export function InlineBlock({
}: InlineBlockProps) {
return (
<InlineFieldContext.Provider value={{ name, ...block }}>
<block.Component data={data} index={index} {...itemProps} />
<block.Component data={data} name={name} index={index} {...itemProps} />
</InlineFieldContext.Provider>
)
}
Expand Down

0 comments on commit 8d42e9a

Please sign in to comment.