diff --git a/CHANGELOG.md b/CHANGELOG.md index 79027d86..683217c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ - Light color theme enhancements to folder cards - [#272](https://github.com/estruyf/vscode-front-matter/issues/272): New slide over panel for showing details of media files - [#276](https://github.com/estruyf/vscode-front-matter/issues/276): Add a Front Matter walkthrough for VS Code +- [#270](https://github.com/estruyf/vscode-front-matter/issues/270): Only show media files from public folder if `pageBundle` is not enabled on any of the content types +- [#282](https://github.com/estruyf/vscode-front-matter/issues/282): Insert relative paths for media files located in a page bundle (also sub-folders) ### 🐞 Fixes diff --git a/src/commands/Article.ts b/src/commands/Article.ts index ca306def..349c3182 100644 --- a/src/commands/Article.ts +++ b/src/commands/Article.ts @@ -1,3 +1,4 @@ +import { DEFAULT_CONTENT_TYPE } from './../constants/ContentType'; import { isValidFile } from './../helpers/isValidFile'; import { SETTING_AUTO_UPDATE_DATE, SETTING_MODIFIED_FIELD, SETTING_SLUG_UPDATE_FILE_NAME, SETTING_TEMPLATES_PREFIX, CONFIG_KEY, SETTING_DATE_FORMAT, SETTING_SLUG_PREFIX, SETTING_SLUG_SUFFIX, SETTING_CONTENT_PLACEHOLDERS, TelemetryEvent } from './../constants'; import * as vscode from 'vscode'; @@ -326,11 +327,15 @@ export class Article { return; } + const article = ArticleHelper.getFrontMatter(editor); + const contentType = article && article.data ? ArticleHelper.getContentType(article.data) : DEFAULT_CONTENT_TYPE; + const position = editor.selection.active; await vscode.commands.executeCommand(COMMAND_NAME.dashboard, { type: "media", data: { + pageBundle: !!contentType.pageBundle, filePath: editor.document.uri.fsPath, fieldName: basename(editor.document.uri.fsPath), position diff --git a/src/constants/ContentType.ts b/src/constants/ContentType.ts index a2ea1003..cd89f77f 100644 --- a/src/constants/ContentType.ts +++ b/src/constants/ContentType.ts @@ -20,7 +20,9 @@ export const DEFAULT_CONTENT_TYPE: ContentType = { { "title": "Publishing date", "name": "date", - "type": "datetime" + "type": "datetime", + "default": "{{now}}", + "isPublishDate": true }, { "title": "Content preview", diff --git a/src/dashboardWebView/components/Media/FolderItem.tsx b/src/dashboardWebView/components/Media/FolderItem.tsx index 8a959ab2..88988cf5 100644 --- a/src/dashboardWebView/components/Media/FolderItem.tsx +++ b/src/dashboardWebView/components/Media/FolderItem.tsx @@ -1,5 +1,5 @@ -import {FolderIcon} from '@heroicons/react/solid'; -import { basename } from 'path'; +import {DocumentIcon, FolderIcon} from '@heroicons/react/solid'; +import { basename, join } from 'path'; import * as React from 'react'; import { useRecoilState } from 'recoil'; import { SelectedMediaFolderAtom } from '../../state'; @@ -14,12 +14,19 @@ export const FolderItem: React.FunctionComponent = ({ folder, const [ , setSelectedFolder ] = useRecoilState(SelectedMediaFolderAtom); const relFolderPath = wsFolder ? folder.replace(wsFolder, '') : folder; + + const isContentFolder = React.useMemo(() => !relFolderPath.includes(join('/', staticFolder || '', '/')), [relFolderPath, staticFolder]); return (
  • -