Skip to content

Commit

Permalink
Add disable enter setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
robgietema committed Oct 5, 2024
1 parent fcf4777 commit 8b6b1ca
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ const BlocksForm = (props) => {
onFocusNextBlock(block, node, isMultipleSelection);
e.preventDefault();
}
if (e.key === 'Enter' && !disableEnter) {

const blockConfig =
blocksConfig[properties[getBlocksFieldname(properties)][block]['@type']];

if (e.key === 'Enter' && !disableEnter && !blockConfig.disableEnter) {
if (!disableAddBlockOnEnterKey) {
onSelectBlock(onAddBlock(config.settings.defaultBlockType, index + 1));
}
Expand Down

1 comment on commit 8b6b1ca

@davisagli
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robgietema For the form block, I don't think we want to disable adding a new block if you hit enter while the form block has focus. We just want to disable propagating the keypress outside of the modal when it is open.

Please sign in to comment.