Skip to content

Commit

Permalink
Adding new text block via dropdown when current block is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek-17h committed Jan 12, 2025
1 parent 1c88feb commit 82efe76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/volto/news/6574.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implemented functionality to add a new text block via the dropdown menu, even when the current text block is empty. @Abhishek-17h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,16 @@ const BlockChooserButton = (props) => {
onInsertBlock={
onInsertBlock
? (id, value) => {
setAddNewBlockOpened(false);
onInsertBlock(id, value);
if (
data['@type'] === value['@type'] &&
value['@type'] === 'slate'
) {
onMutateBlock(block, { ...data, ...value });
setAddNewBlockOpened(false);
} else {
setAddNewBlockOpened(false);
onInsertBlock(id, value);
}
}
: null
}
Expand Down

0 comments on commit 82efe76

Please sign in to comment.