Skip to content

Commit 4db7a8d

Browse files
committed
Transfer enhanced VLT schema
1 parent 2ca1a75 commit 4db7a8d

File tree

1 file changed

+38
-9
lines changed
  • packages/volto-button-block/src/components

1 file changed

+38
-9
lines changed

packages/volto-button-block/src/components/schema.js

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineMessages } from 'react-intl';
2+
import { addStyling } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer';
23

34
const messages = defineMessages({
45
ButtonBlock: {
@@ -25,18 +26,25 @@ const messages = defineMessages({
2526
id: 'Open in a new tab',
2627
defaultMessage: 'Open in a new tab',
2728
},
29+
BlockWidth: {
30+
id: 'Block Width',
31+
defaultMessage: 'Block Width',
32+
},
33+
Alignment: {
34+
id: 'Alignment',
35+
defaultMessage: 'Alignment',
36+
},
2837
});
2938

3039
export const ButtonSchema = (props) => {
3140
const { intl } = props;
32-
33-
return {
41+
const schema = {
3442
title: intl.formatMessage(messages.ButtonBlock),
3543
fieldsets: [
3644
{
3745
id: 'default',
3846
title: 'Default',
39-
fields: ['title', 'href', 'openLinkInNewTab', 'inneralign'],
47+
fields: ['title', 'href', 'openLinkInNewTab'],
4048
},
4149
],
4250

@@ -51,17 +59,38 @@ export const ButtonSchema = (props) => {
5159
selectedItemAttrs: ['Title', 'Description', 'hasPreviewImage'],
5260
allowExternals: true,
5361
},
54-
inneralign: {
55-
title: props.intl.formatMessage(messages.innerAlign),
56-
widget: 'align',
57-
actions: ['left', 'center', 'right'],
58-
default: 'left',
59-
},
6062
openLinkInNewTab: {
6163
title: intl.formatMessage(messages.openLinkInNewTab),
6264
type: 'boolean',
6365
},
6466
},
6567
required: [],
6668
};
69+
70+
addStyling({ schema, intl });
71+
72+
schema.properties.styles.schema.fieldsets[0].fields = [
73+
'blockWidth:noprefix',
74+
...schema.properties.styles.schema.fieldsets[0].fields,
75+
];
76+
77+
schema.properties.styles.schema.fieldsets[0].fields = [
78+
'align:noprefix',
79+
...schema.properties.styles.schema.fieldsets[0].fields,
80+
];
81+
82+
schema.properties.styles.schema.properties['blockWidth:noprefix'] = {
83+
widget: 'blockWidth',
84+
title: intl.formatMessage(messages.BlockWidth),
85+
default: 'default',
86+
filterActions: ['narrow', 'default'],
87+
};
88+
89+
schema.properties.styles.schema.properties['align:noprefix'] = {
90+
widget: 'blockAlignment',
91+
title: intl.formatMessage(messages.Alignment),
92+
default: 'left',
93+
};
94+
95+
return schema;
6796
};

0 commit comments

Comments
 (0)