mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-06-18 00:55:18 +02:00
#306 - Default value fix
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
- [#302](https://github.com/estruyf/vscode-front-matter/issues/302): Fix for spinner when navigating between tabs
|
||||
- [#304](https://github.com/estruyf/vscode-front-matter/issues/304): Fix yaml stringify which caused additional fields to be added
|
||||
- [#305](https://github.com/estruyf/vscode-front-matter/issues/305): Fix for overflow issue in taxonomy picker
|
||||
- [#306](https://github.com/estruyf/vscode-front-matter/issues/306): Fix for default value of content type fields
|
||||
|
||||
## [7.0.0] - 2022-03-21 - [Release notes](https://beta.frontmatter.codes/updates/v7.0.0)
|
||||
|
||||
|
||||
+1
-1
@@ -748,7 +748,7 @@
|
||||
"description": "Title to show in the UI"
|
||||
},
|
||||
"default": {
|
||||
"type": "string",
|
||||
"type": ["string", "number", "boolean", "array", "object", "null"],
|
||||
"description": "Default value"
|
||||
},
|
||||
"choices": {
|
||||
|
||||
@@ -152,8 +152,14 @@ export class ContentType {
|
||||
if (field.type === "fields") {
|
||||
data[field.name] = this.processFields(field, titleValue, {});
|
||||
} else {
|
||||
data[field.name] = field.default ? processKnownPlaceholders(field.default, titleValue, dateFormat) : "";
|
||||
data[field.name] = field.default ? ArticleHelper.processCustomPlaceholders(data[field.name], titleValue) : "";
|
||||
const defaultValue = field.default;
|
||||
|
||||
if (typeof defaultValue === "string") {
|
||||
data[field.name] = processKnownPlaceholders(defaultValue, titleValue, dateFormat);
|
||||
data[field.name] = ArticleHelper.processCustomPlaceholders(data[field.name], titleValue);
|
||||
} else {
|
||||
data[field.name] = typeof defaultValue !== "undefined" ? defaultValue : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user