mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Enhancement: Add property to page folder setting to disable content creation #674
This commit is contained in:
@@ -299,6 +299,11 @@
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"disableCreation": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%setting.frontMatter.content.pageFolders.items.properties.disableCreation.description%"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"setting.frontMatter.content.pageFolders.items.properties.previewPath.description": "Defines a custom preview path for the folder.",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.filePrefix.description": "Defines a prefix for the file name.",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.contentTypes.description": "Defines which content types can be used for the current location. If not defined, all content types will be available.",
|
||||
"setting.frontMatter.content.pageFolders.items.properties.disableCreation.description": "Disable the creation of new content in the folder.",
|
||||
"setting.frontMatter.content.placeholders.markdownDescription": "This array of placeholders defines the placeholders that you can use in your content types and templates for automatically populating your content its front matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.content.placeholders)",
|
||||
"setting.frontMatter.content.placeholders.items.properties.id.description": "ID of the placeholder, in your content type or template, use it as follows: {{placeholder}}",
|
||||
"setting.frontMatter.content.placeholders.items.properties.value.description": "The placeholder its value",
|
||||
|
||||
@@ -95,7 +95,7 @@ export class Folders {
|
||||
return;
|
||||
}
|
||||
|
||||
const folders = Folders.get();
|
||||
const folders = Folders.get().filter((f) => !f.disableCreation);
|
||||
const location = folders.find((f) => f.title === selectedFolder);
|
||||
if (location) {
|
||||
const folderPath = Folders.getFolderPath(Uri.file(location.path));
|
||||
|
||||
@@ -85,7 +85,7 @@ export class ContentType {
|
||||
}
|
||||
|
||||
const contentTypes = ContentType.getAll();
|
||||
const folders = Folders.get();
|
||||
const folders = Folders.get().filter((f) => !f.disableCreation);
|
||||
const folder = folders.find((f) => f.title === selectedFolder);
|
||||
|
||||
if (!folder) {
|
||||
|
||||
@@ -116,7 +116,7 @@ export class Questions {
|
||||
public static async SelectContentFolder(
|
||||
showWarning: boolean = true
|
||||
): Promise<string | undefined> {
|
||||
let folders = Folders.get();
|
||||
let folders = Folders.get().filter((f) => !f.disableCreation);
|
||||
|
||||
let selectedFolder: string | undefined;
|
||||
if (folders.length > 1) {
|
||||
|
||||
@@ -2,6 +2,7 @@ export interface ContentFolder {
|
||||
title: string;
|
||||
path: string;
|
||||
|
||||
disableCreation?: boolean;
|
||||
excludeSubdir?: boolean;
|
||||
previewPath?: string;
|
||||
filePrefix?: string;
|
||||
|
||||
Reference in New Issue
Block a user