Skip to content

Commit

Permalink
Add support for onInsertBlock with BlockChooser
Browse files Browse the repository at this point in the history
  • Loading branch information
avoinea committed Apr 7, 2021
1 parent e7d8824 commit 0e37fb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/manage/Blocks/Accordion/EditBlockWrapper.jsx
Expand Up @@ -72,7 +72,9 @@ class EditBlockWrapper extends React.Component {
block,
data,
onDeleteBlock,
onInsertBlock,
onMutateBlock,
onSelectBlock,
selected,
} = blockProps;
const type = data['@type'];
Expand Down Expand Up @@ -148,8 +150,12 @@ class EditBlockWrapper extends React.Component {
{this.state.addNewBlockOpened && (
<BlockChooser
onMutateBlock={(id, value) => {
this.setState({ addNewBlockOpened: false });
onMutateBlock(id, value);
this.setState({ addNewBlockOpened: false });
}}
onInsertBlock={(id, value) => {
onSelectBlock(onInsertBlock(id, value));
this.setState({ addNewBlockOpened: false });
}}
currentBlock={block}
allowedBlocks={allowedBlocks}
Expand Down

0 comments on commit 0e37fb3

Please sign in to comment.