Skip to content

Commit

Permalink
Moved applyBlockDefaults one component up so the style is computed …
Browse files Browse the repository at this point in the history
…correctly (#6451)
  • Loading branch information
sneridagh authored Oct 29, 2024
1 parent ec89ad8 commit ec4dc83
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/volto/news/6451.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Moved `applyBlockDefaults` one component up so the style is computed correctly. @sneridagh
3 changes: 1 addition & 2 deletions packages/volto/src/components/manage/Blocks/Block/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import cx from 'classnames';
import { setSidebarTab, setUIState } from '@plone/volto/actions';
import config from '@plone/volto/registry';
import withObjectBrowser from '@plone/volto/components/manage/Sidebar/ObjectBrowser';
import { applyBlockDefaults } from '@plone/volto/helpers';
import { ViewDefaultBlock, EditDefaultBlock } from '@plone/volto/components';

import {
Expand Down Expand Up @@ -199,7 +198,7 @@ export class Edit extends Component {
<Block
{...this.props}
blockNode={this.blockNode}
data={applyBlockDefaults(this.props)}
data={this.props.data}
/>
{this.props.manage && (
<SidebarPortal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Icon } from '@plone/volto/components';
import {
applyBlockDefaults,
applyBlockInitialValue,
getBlocksFieldname,
blockHasValue,
Expand Down Expand Up @@ -48,14 +49,16 @@ const EditBlockWrapper = (props) => {
onInsertBlock,
onSelectBlock,
onMutateBlock,
data,
data: originalData,
editable,
properties,
showBlockChooser,
navRoot,
contentType,
} = blockProps;

const data = applyBlockDefaults({ data: originalData, ...blockProps, intl });

const visible = selected && !hideHandler(data);

const required = isBoolean(data.required)
Expand Down

0 comments on commit ec4dc83

Please sign in to comment.