Closed CarloBu closed 1 month ago
that would be even better for DX. 👍 you could give the nice UX addition by changing the color of the character counter to red when the pattern is not met, and to blue when the character count meets the requirements.
Yeah, I’m thinking about it. 😆
Wow! You did more work this evening than the entire Decap team did in a whole month. :)
this is so clean from DX side:
- name: test
label: Test
folder: src/content/test
create: true
fields:
- label: Description
name: description
widget: string
minlength: 10
maxlength: 70
I'm building a strict Website layout where I want to limit the maximum character length for the client.![image](https://github.com/sveltia/sveltia-cms/assets/145860771/54a50ce6-9ed0-46af-b003-8e7267df8cbe)
By the example above, If the client puts an entire Shakespeare sentence in the title, it will break all the design. It would be great to limit the character count, but I miss this feature in the Sveltia CMS.
would it be possible to implement this feature using regex? For example, yaml could look like this:
and the UI could show the current character count and maximum count - 65/70 like in the example in Sanity UI.
Going even further could be possible to implement the range: pattern: ['^.{20,70}$', 'Must not exceed 70 characters'] <- using regex and to show in the UI: 20//70
20/36/70
but I don't know at what scenario to use the min character limit.