Skip to content

Commit

Permalink
change(column-block): removing styling schema enhancer from current p…
Browse files Browse the repository at this point in the history
…ackage

- moved code to our package eea-website-policy which we can add on several
  packages
  • Loading branch information
ichim-david committed Nov 3, 2022
1 parent 4df86f7 commit 10a3cab
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 62 deletions.
5 changes: 0 additions & 5 deletions src/ColumnsBlock/icons/image-narrow.svg

This file was deleted.

55 changes: 0 additions & 55 deletions src/ColumnsBlock/schema.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
import { defineMessages } from 'react-intl';
import { cloneDeep } from 'lodash';

import config from '@plone/volto/registry';

import imageFitSVG from '@eeacms/volto-columns-block/ColumnsBlock/icons/image-narrow.svg';
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
import imageFullSVG from '@plone/volto/icons/image-full.svg';
import { COLUMNSBLOCK } from '../constants';

const ALIGN_INFO_MAP = {
narrow_width: [imageFitSVG, 'Narrow width'],
container_width: [imageFitSVG, 'Container width'],
wide_width: [imageWideSVG, 'Wide width'],
full: [imageFullSVG, 'Full width'],
};

const messages = defineMessages({
labelColumn: {
Expand Down Expand Up @@ -95,43 +80,3 @@ export const ColumnsBlockSchema = (intl) => ({
},
required: [],
});

export const addStylingFieldsetSchemaEnhancer = ({ schema }) => {
const applied = schema.fieldsets[0].fields.includes('styling');
const enableStyling = config.blocks.blocksConfig[COLUMNSBLOCK].enableStyling;

if (!applied && enableStyling) {
const resSchema = cloneDeep(schema);

resSchema.fieldsets.push({
id: 'styling',
fields: ['styles'],
title: 'Styling',
});
resSchema.properties.styles = {
widget: 'object',
title: 'Styling',
schema: {
fieldsets: [
{
id: 'default',
title: 'Default',
fields: ['size'],
},
],
properties: {
size: {
widget: 'style_align',
title: 'Section size',
actions: Object.keys(ALIGN_INFO_MAP),
actionsInfoMap: ALIGN_INFO_MAP,
},
},
required: [],
},
};
return resSchema;
}

return schema;
};
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export default function install(config) {
mostUsed: false,
blockHasOwnFocusManagement: true,
schema: extendedSchema(config),
enableStyling: true,
schemaEnhancer: addStylingFieldsetSchemaEnhancer,
sidebarTab: 1,
security: {
addPermission: [],
Expand Down

0 comments on commit 10a3cab

Please sign in to comment.