mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-07 01:13:08 +02:00
Fix issue with default field value in field's 'when' clause #872
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- [#872](https://github.com/estruyf/vscode-front-matter/issues/872): Check the default field value as well for the field's `when` clause
|
||||
- [#874](https://github.com/estruyf/vscode-front-matter/issues/874): Fix media snippet markup insertion to article content's
|
||||
- [#875](https://github.com/estruyf/vscode-front-matter/issues/875): Clean up the exclamation marks from the file name when creating new content
|
||||
|
||||
|
||||
@@ -22,7 +22,10 @@ export const fieldWhenClause = (field: Field, parent: IMetadata, allFields?: Fie
|
||||
}
|
||||
}
|
||||
|
||||
const whenValue = parent[when.fieldRef];
|
||||
let whenValue = parent[when.fieldRef];
|
||||
if (whenValue === undefined) {
|
||||
whenValue = field.default as string | IMetadata | string[] | null;
|
||||
}
|
||||
if (when.caseSensitive || typeof when.caseSensitive === 'undefined') {
|
||||
return caseSensitive(when, field, whenValue);
|
||||
} else {
|
||||
@@ -61,7 +64,7 @@ const caseInsensitive = (
|
||||
*/
|
||||
const caseSensitive = (
|
||||
when: WhenClause,
|
||||
field: Field,
|
||||
_: Field,
|
||||
whenValue: string | IMetadata | string[] | null
|
||||
) => {
|
||||
switch (when.operator) {
|
||||
|
||||
Reference in New Issue
Block a user