mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-07 01:13:08 +02:00
Filter out empty folder settings + added the content type name
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
### ⚡️ Optimizations
|
||||
|
||||
- Dashboard layout grid optimizations
|
||||
- Added the content-type name to the metadata section in the panel
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
|
||||
@@ -361,7 +361,10 @@ export class Folders {
|
||||
*/
|
||||
public static get(): ContentFolder[] {
|
||||
const wsFolder = Folders.getWorkspaceFolder();
|
||||
const folders: ContentFolder[] = Settings.get(SETTING_CONTENT_PAGE_FOLDERS) as ContentFolder[];
|
||||
let folders: ContentFolder[] = Settings.get(SETTING_CONTENT_PAGE_FOLDERS) as ContentFolder[];
|
||||
|
||||
// Filter out folders without a path
|
||||
folders = folders.filter((f) => f.path);
|
||||
|
||||
const contentFolders = folders.map((folder) => {
|
||||
if (!folder.title) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function useContentType(
|
||||
|
||||
// Get the content type by the folder name
|
||||
const pageFolders = settings.contentFolders;
|
||||
let pageFolderMatches = pageFolders.filter((folder) => metadata.filePath.includes(folder.path));
|
||||
let pageFolderMatches = pageFolders.filter((folder) => metadata.filePath && folder.path && metadata.filePath.includes(folder.path));
|
||||
|
||||
// Sort by longest path
|
||||
pageFolderMatches = pageFolderMatches.sort((a, b) => b.path.length - a.path.length);
|
||||
|
||||
@@ -89,7 +89,7 @@ const Metadata: React.FunctionComponent<IMetadataProps> = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Collapsible id={`tags`} title={l10n.t(LocalizationKey.panelMetadataTitle)} className={`inherit z-20`}>
|
||||
<Collapsible id={`tags`} title={`${l10n.t(LocalizationKey.panelMetadataTitle)}${contentType?.name ? ` (${contentType?.name})` : ""}`} className={`inherit z-20`}>
|
||||
<FeatureFlag features={features || []} flag={FEATURE_FLAG.panel.contentType}>
|
||||
<ContentTypeValidator fields={contentType?.fields || []} metadata={metadata} />
|
||||
</FeatureFlag>
|
||||
|
||||
Reference in New Issue
Block a user