Skip to content

Commit

Permalink
Remove teaser styling tab inside grids since it's empty (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh authored Dec 13, 2024
1 parent 50c906d commit ef23207
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/volto-light-theme/news/449.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove teaser styling tab inside grids since it's empty. @sneridagh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ export const teaserSchemaEnhancer = ({ schema, formData, intl }) => {
return schema;
};

// Not sure why, but it was in the new one, check with blockModel3
// export const gridTeaserDisableStylingSchema = ({ schema, formData, intl }) => {
// schema.fieldsets = schema.fieldsets.filter((item) => item.id !== 'styling');
// return schema;
// };
export const gridTeaserDisableStylingSchema = ({ schema, formData, intl }) => {
// Remove all the existing fields from the default schema
schema.properties.styles.schema.fieldsets[0].fields = [];
schema.fieldsets = schema.fieldsets.filter((item) => item.id !== 'styling');
return schema;
};

Expand Down
5 changes: 3 additions & 2 deletions packages/volto-light-theme/src/config/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { composeSchema } from '@plone/volto/helpers/Extensions';
import { findStyleByName } from '@plone/volto/helpers/Blocks/Blocks';
import { defaultStylingSchema } from '../components/Blocks/schema';
import {
gridTeaserDisableAlignHandlersSchema,
gridTeaserDisableStylingSchema,
teaserSchemaEnhancer,
} from '../components/Blocks/Teaser/schema';
import { videoBlockSchemaEnhancer } from '../components/Blocks/Video/schema';
Expand Down Expand Up @@ -136,6 +136,7 @@ export default function install(config: ConfigType) {
if (!data['@type']) return {};
if (data.theme) {
const blockConfig = config.blocks.blocksConfig[data['@type']];
if (!blockConfig) return {};
const blockStyleDefinitions =
// We look up for the blockThemes in the block's config, then in the global config
// We keep `colors` for BBB, but `themes` should be used
Expand Down Expand Up @@ -253,7 +254,7 @@ export default function install(config: ConfigType) {
ImageBlockDataAdapter;

config.blocks.blocksConfig.gridBlock.blocksConfig.teaser.schemaEnhancer =
composeSchema(gridTeaserDisableAlignHandlersSchema, teaserSchemaEnhancer);
composeSchema(teaserSchemaEnhancer, gridTeaserDisableStylingSchema);

config.blocks.blocksConfig.gridBlock.blocksConfig.listing.allowed_headline_tags =
[['h2', 'h2']];
Expand Down

0 comments on commit ef23207

Please sign in to comment.