I'm trying to add a size
field to the video block alongside the alignment. The options available in this field should be dependent on what the align
value from the align field is. Updating the available choices works great, but when I try to update the default value (so that when the user changes to a different alignment, the value is still valid), I would have expected either the default
field or the value
field to set this (code below), but it doesn't seem to have any effect. Am I missing a schema config option here, or is this not possible in Volto currently?
const alignmentPositionSizeMapping = {
center: [
['fullWidth', 'Full width'],
['90', '90%'],
...
],
left: [
['50', '50%'],
['40', '40%'],
['30', '30%'],
...
],
...
};
schema.properties.size = {
title: intl.formatMessage(messages.size),
type: 'string',
factory: 'Choice',
choices: formData.align
? alignmentPositionSizeMapping[formData.align]
: alignmentPositionSizeMapping['center'],
default: formData.align
? alignmentPositionSizeMapping[formData.align][0]
: 'fullWidth'
value: formData.size
? formData.size
: formData.align
? alignmentPositionSizeMapping[formData.align][0]
: 'fullWidth',
};