apostrophecms / apostrophecms/apostrophe
Limit Amount of a Widget Type in an Area
- Dominant language
- JavaScript
- Stars
- 4.6k
- Forks
- 650
- Avg merge
- 19h 21m
- Merged PRs (30d)
- 23
Description
I know I can limit the number of widgets in an area with
```
main: {
type: 'area',
options: {
widgets: {
'@apostrophecms/rich-text': {},
'@apostrophecms/image': {},
'@apostrophecms/video': {}
},
max: 3
}
}
```
but is there any way to limit the amount of any specific widget in that area? e.g.
```
main: {
type: 'area',
options: {
widgets: {
'@apostrophecms/rich-text': {},
'@apostrophecms/image': {},
'@apostrophecms/video': {
max: 1 // 👈 this puppy here means only one video widget in this area
}
},
max: 3
}
}
```
I know I could make another area, but the order of areas in the page is still fixed; this feature would allow users to re-organise the area content avoiding this fixed-layout problem.
Contributor guide
Research direction
Start with the area configuration and existing area-wide max behavior shown in the issue, then locate the implementation and tests that handle those options. Done means a per-widget maximum can be configured without preventing users from reordering mixed widgets, with the behavior covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- content
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100