mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-07 17:32:58 +02:00
#539 - fix file prefix
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
- [#521](https://github.com/estruyf/vscode-front-matter/issues/521): Fix empty snippets dashboard placeholder
|
||||
- [#526](https://github.com/estruyf/vscode-front-matter/issues/526): Fix card content menu
|
||||
- [#531](https://github.com/estruyf/vscode-front-matter/issues/531): Fix prettier update which caused data views to not render list items
|
||||
- [#539](https://github.com/estruyf/vscode-front-matter/issues/539): Fix the override of the default file prefix on content creation
|
||||
|
||||
## [8.3.0] - 2023-02-14 - [Release notes](https://beta.frontmatter.codes/updates/v8.3.0)
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ export class Article {
|
||||
|
||||
let filePrefix = Settings.get<string>(SETTING_TEMPLATES_PREFIX);
|
||||
const contentType = ArticleHelper.getContentType(article.data);
|
||||
filePrefix = ArticleHelper.getFilePrefix(editor.document.uri.fsPath, contentType);
|
||||
filePrefix = ArticleHelper.getFilePrefix(filePrefix, editor.document.uri.fsPath, contentType);
|
||||
|
||||
const titleField = 'title';
|
||||
const articleTitle: string = article.data[titleField];
|
||||
|
||||
@@ -383,7 +383,7 @@ export class ArticleHelper {
|
||||
const fileType = Settings.get<string>(SETTING_CONTENT_DEFAULT_FILETYPE);
|
||||
|
||||
let prefix = Settings.get<string>(SETTING_TEMPLATES_PREFIX);
|
||||
prefix = ArticleHelper.getFilePrefix(folderPath, contentType);
|
||||
prefix = ArticleHelper.getFilePrefix(prefix, folderPath, contentType);
|
||||
|
||||
// Name of the file or folder to create
|
||||
let sanitizedName = ArticleHelper.sanitize(titleValue);
|
||||
@@ -436,8 +436,14 @@ export class ArticleHelper {
|
||||
* @param contentType
|
||||
* @returns
|
||||
*/
|
||||
public static getFilePrefix(filePath?: string, contentType?: ContentType): string | undefined {
|
||||
let prefix = undefined;
|
||||
public static getFilePrefix(
|
||||
prefix: string | null | undefined,
|
||||
filePath?: string,
|
||||
contentType?: ContentType
|
||||
): string | undefined {
|
||||
if (!prefix) {
|
||||
prefix = undefined;
|
||||
}
|
||||
|
||||
// Retrieve the file prefix from the folder
|
||||
if (filePath) {
|
||||
|
||||
Reference in New Issue
Block a user