mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-08 09:53:20 +02:00
Merge branch 'dev' of github.com:estruyf/vscode-front-matter into dev
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
- [#664](https://github.com/estruyf/vscode-front-matter/issues/664): Fix for parsing draft status in Hexo and Jekyll
|
||||
- [#665](https://github.com/estruyf/vscode-front-matter/issues/665): Added `dev` parameter to Nuxt script
|
||||
- [#668](https://github.com/estruyf/vscode-front-matter/issues/668): Reset pagination on media search
|
||||
- [#678](https://github.com/estruyf/vscode-front-matter/issues/678): Check field type of `tags` fields for tags rendering on item cards
|
||||
|
||||
## [9.2.0] - 2023-09-11
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ export const Item: React.FunctionComponent<IItemProps> = ({
|
||||
if (typeof tagsValue === 'string') {
|
||||
return [tagsValue];
|
||||
} else if (Array.isArray(tagsValue)) {
|
||||
return tagsValue;
|
||||
const items = tagsValue.map(t => typeof t === 'string' ? t : undefined);
|
||||
return items.filter(t => t !== undefined) as string[];
|
||||
}
|
||||
|
||||
return [];
|
||||
|
||||
@@ -8,6 +8,6 @@ export const PinIcon: React.FunctionComponent<IPinIconProps> = ({
|
||||
className
|
||||
}: React.PropsWithChildren<IPinIconProps>) => {
|
||||
return (
|
||||
<svg className={className || ""} stroke="currentColor" fill="currentColor" stroke-width=".5" viewBox="0 0 16 16" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M14 5v7h-.278c-.406 0-.778-.086-1.117-.258A2.528 2.528 0 0 1 11.73 11H8.87a3.463 3.463 0 0 1-.546.828 3.685 3.685 0 0 1-.735.633c-.27.177-.565.31-.882.398a3.875 3.875 0 0 1-.985.141h-.5V9H2l-1-.5L2 8h3.222V4h.5c.339 0 .664.047.977.14.312.094.607.227.883.4A3.404 3.404 0 0 1 8.87 6h2.859a2.56 2.56 0 0 1 .875-.734c.338-.172.71-.26 1.117-.266H14zm-.778 1.086a1.222 1.222 0 0 0-.32.156 1.491 1.491 0 0 0-.43.461L12.285 7H8.183l-.117-.336a2.457 2.457 0 0 0-.711-1.047C7.027 5.331 6.427 5.09 6 5v7c.427-.088 1.027-.33 1.355-.617.328-.287.565-.636.71-1.047L8.184 10h4.102l.18.297c.057.094.122.177.195.25.073.073.153.143.242.21.088.069.195.12.32.157V6.086z"></path></svg>
|
||||
<svg className={className || ""} stroke="currentColor" fill="currentColor" strokeWidth=".5" viewBox="0 0 16 16" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M14 5v7h-.278c-.406 0-.778-.086-1.117-.258A2.528 2.528 0 0 1 11.73 11H8.87a3.463 3.463 0 0 1-.546.828 3.685 3.685 0 0 1-.735.633c-.27.177-.565.31-.882.398a3.875 3.875 0 0 1-.985.141h-.5V9H2l-1-.5L2 8h3.222V4h.5c.339 0 .664.047.977.14.312.094.607.227.883.4A3.404 3.404 0 0 1 8.87 6h2.859a2.56 2.56 0 0 1 .875-.734c.338-.172.71-.26 1.117-.266H14zm-.778 1.086a1.222 1.222 0 0 0-.32.156 1.491 1.491 0 0 0-.43.461L12.285 7H8.183l-.117-.336a2.457 2.457 0 0 0-.711-1.047C7.027 5.331 6.427 5.09 6 5v7c.427-.088 1.027-.33 1.355-.617.328-.287.565-.636.71-1.047L8.184 10h4.102l.18.297c.057.094.122.177.195.25.073.073.153.143.242.21.088.069.195.12.32.157V6.086z"></path></svg>
|
||||
);
|
||||
};
|
||||
+25
-14
@@ -238,21 +238,32 @@ export class PagesParser {
|
||||
previewFieldParents = ['preview'];
|
||||
}
|
||||
}
|
||||
// Retrieve the tags from the artilce
|
||||
let tagParents = ContentType.findFieldsByTypeDeep(contentType.fields, 'tags');
|
||||
if (tagParents.length > 0) {
|
||||
const firstField = tagParents[0];
|
||||
if (firstField.length > 0) {
|
||||
const tagsValue = ContentType.getFieldValue(
|
||||
article.data,
|
||||
firstField.map((f) => f.name)
|
||||
);
|
||||
page.fmTags = typeof tagsValue === 'string' ? tagsValue.split(',') : tagsValue;
|
||||
}
|
||||
}
|
||||
|
||||
let tagParents = ContentType.findFieldByType(contentType.fields, 'tags');
|
||||
const tagsValue = ContentType.getFieldValue(
|
||||
article.data,
|
||||
tagParents.length !== 0 ? tagParents : ['tags']
|
||||
);
|
||||
page.fmTags = typeof tagsValue === 'string' ? tagsValue.split(',') : tagsValue;
|
||||
|
||||
let categoryParents = ContentType.findFieldByType(contentType.fields, 'categories');
|
||||
const categoriesValue = ContentType.getFieldValue(
|
||||
article.data,
|
||||
categoryParents.length !== 0 ? categoryParents : ['categories']
|
||||
);
|
||||
page.fmCategories =
|
||||
typeof categoriesValue === 'string' ? categoriesValue.split(',') : categoriesValue;
|
||||
// Retrieve the categories from the artilce
|
||||
let categoryParents = ContentType.findFieldsByTypeDeep(contentType.fields, 'categories');
|
||||
if (categoryParents.length > 0) {
|
||||
const firstField = categoryParents[0];
|
||||
if (firstField.length > 0) {
|
||||
const categoriesValue = ContentType.getFieldValue(
|
||||
article.data,
|
||||
firstField.map((f) => f.name)
|
||||
);
|
||||
page.fmCategories =
|
||||
typeof categoriesValue === 'string' ? categoriesValue.split(',') : categoriesValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if parent fields were retrieved, if not there was no image present
|
||||
if (previewFieldParents.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user