This release added several new Input validation keys, a template HTML element and better default behavior for Array Editable Regions, and support for square brackets in data-prop key.
It also addressed several issues, including those affecting Component Editable Regions where data-prop referenced an external file, the Avatars list when collaboratively editing a file, and the image cropper in File Inputs.
Features & Improvements#
- Added the
min_graphemes,min_graphemes_message,max_graphemes,max_graphemes_message,min_words,min_words_message,max_words,max_words_message, andlocaleconfiguration keys for Input validation. These keys are available for Code, Color, File, Select, Text, Rich Text, and URL Inputs. To use this key in a Select Input,allow_createmust be set totrue.- The
min_graphemesandmax_graphemeskeys define the string length, in graphemes, that CloudCannon will allow in an Input. Themin_graphemes_messageandmax_graphemes_messagekeys define custom error messages that explain why a value has failed the validation criteria. - The
min_wordsandmax_wordskeys define the string length, in words, that CloudCannon will allow in an Input. Themin_words_messageandmax_words_messagekeys define custom error messages that explain why a value has failed the validation criteria. - The
localekey defines which language CloudCannon should use to determine a single grapheme or word. This key accepts a single language subtag.
- The
cloudcannon.config.yaml
copied
_inputs:
description:
type: markdown
options:
min_words: 1
max_words: 10
locale: jp
caption:
type: markdown
options:
min_graphemes: 1
max_graphemes: 10
locale: en-US
cloudcannon.config.json
copied
{
"_inputs": {
"description": {
"type": "markdown",
"options": {
"min_words": 1,
"max_words": 10,
"locale": "jp"
}
},
"caption": {
"type": "markdown",
"options": {
"min_graphemes": 1,
"max_graphemes": 10,
"locale": "en-US"
}
}
}
}- For Array Editable Regions, you can now use
<template>HTML elements to populate new array items rather than registering components. You can add thedata-idattribute to each<template>element, allowing you to define several array item templates.
layout.astro
copied
<editable-array data-prop="my_array" data-id-key="_name">
<template data-id="hero">
<h1 data-editable="text" data-prop="title"></h1>
</template>
<template data-id="testimonials">
<div>
<p data-editable="text" data-prop="message"></p>
</div>
</template>
...
</editable-array>
- For Array Editable Regions in complex arrays or page building, CloudCannon will now use the value of
data-component-keyanddata-componentas the value fordata-id-keyanddata-idby default, when the latter are undefined. - Editable Regions now support
[]square brackets in the file path for@file,@data, and@collectionspecial values fordata-prop. If your file path contains a single set of[]brackets, you can surround the file path with double[[]]brackets.
Fixes#
- Fixed an issue where Component Editable Regions did not populate correctly when
data-propwas an external file. - Fixed an issue where switching which person was editing a file would make everyone appear to have the same avatar in the Avatars list in the Editing Interface Header.
- Fixed an issue where, when uploading an image using a File Input, CloudCannon would open the image cropper even when the image had the correct dimensions.
- Updated dependencies to patch security vulnerabilities.