mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-08 09:53:20 +02:00
Setting updates
This commit is contained in:
Vendored
-53
@@ -23,58 +23,5 @@
|
||||
"exportall.config.folderListener": [
|
||||
"/src/pagesView/state/atom",
|
||||
"/src/pagesView/state/selectors"
|
||||
],
|
||||
"frontMatter.content.pageFolders": [
|
||||
{
|
||||
"title": "documentation",
|
||||
"path": "[[workspace]]/docs/content/docs"
|
||||
}
|
||||
],
|
||||
"frontMatter.taxonomy.contentTypes": [
|
||||
{
|
||||
"name": "default",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Title",
|
||||
"name": "title",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"title": "Description",
|
||||
"name": "description",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"title": "Publishing date",
|
||||
"name": "date",
|
||||
"type": "datetime"
|
||||
},
|
||||
{
|
||||
"title": "Last modified date",
|
||||
"name": "lastmod",
|
||||
"type": "datetime"
|
||||
},
|
||||
{
|
||||
"title": "Article preview",
|
||||
"name": "preview",
|
||||
"type": "image"
|
||||
},
|
||||
{
|
||||
"title": "Is in draft",
|
||||
"name": "draft",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"title": "Tags",
|
||||
"name": "tags",
|
||||
"type": "tags"
|
||||
},
|
||||
{
|
||||
"title": "Categories",
|
||||
"name": "categories",
|
||||
"type": "categories"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"$schema": "https://beta.frontmatter.codes/frontmatter.schema.json",
|
||||
"frontMatter.content.pageFolders": [
|
||||
{
|
||||
"title": "documentation",
|
||||
"path": "[[workspace]]/docs/content/docs"
|
||||
}
|
||||
],
|
||||
"frontMatter.taxonomy.contentTypes": [
|
||||
{
|
||||
"name": "default",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Title",
|
||||
"name": "title",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"title": "Description",
|
||||
"name": "description",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"title": "Publishing date",
|
||||
"name": "date",
|
||||
"type": "datetime"
|
||||
},
|
||||
{
|
||||
"title": "Last modified date",
|
||||
"name": "lastmod",
|
||||
"type": "datetime"
|
||||
},
|
||||
{
|
||||
"title": "Article preview",
|
||||
"name": "preview",
|
||||
"type": "image"
|
||||
},
|
||||
{
|
||||
"title": "Is in draft",
|
||||
"name": "draft",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"title": "Tags",
|
||||
"name": "tags",
|
||||
"type": "tags"
|
||||
},
|
||||
{
|
||||
"title": "Categories",
|
||||
"name": "categories",
|
||||
"type": "categories"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -82,7 +82,9 @@ export class Extension {
|
||||
}
|
||||
|
||||
// Create team settings
|
||||
Settings.createTeamSettings();
|
||||
if (Settings.hasSettings()) {
|
||||
Settings.createTeamSettings();
|
||||
}
|
||||
|
||||
// Migration to version 4.0.0
|
||||
const dateField = Settings.get<string>(SETTING_DATE_FIELD);
|
||||
|
||||
@@ -172,11 +172,12 @@ export class Settings {
|
||||
const settingNames = Object.keys(pkg.contributes.configuration.properties);
|
||||
|
||||
for (const name of settingNames) {
|
||||
const setting = Settings.config.inspect(name.replace(`frontMatter.`, ''));
|
||||
const settingName = name.replace(`${CONFIG_KEY}.`, '');
|
||||
const setting = Settings.config.inspect(settingName);
|
||||
|
||||
if (setting && typeof setting.workspaceValue !== "undefined") {
|
||||
await Settings.update(name, setting.workspaceValue, true);
|
||||
await Settings.update(name.replace(`frontMatter.`, ''), undefined);
|
||||
await Settings.update(settingName, setting.workspaceValue, true);
|
||||
await Settings.update(settingName, undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,6 +185,30 @@ export class Settings {
|
||||
Notifications.info(`All settings promoted to team level.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there are any Front Matter settings in the workspace
|
||||
* @returns
|
||||
*/
|
||||
public static hasSettings() {
|
||||
let hasSetting = false;
|
||||
|
||||
const pkg = Extension.getInstance().packageJson;
|
||||
if (pkg?.contributes?.configuration?.properties) {
|
||||
const settingNames = Object.keys(pkg.contributes.configuration.properties);
|
||||
|
||||
for (const name of settingNames) {
|
||||
const settingName = name.replace(`${CONFIG_KEY}.`, '');
|
||||
const setting = Settings.config.inspect(settingName);
|
||||
|
||||
if (setting && typeof setting.workspaceValue !== "undefined") {
|
||||
hasSetting = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasSetting;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if its the project config
|
||||
|
||||
Reference in New Issue
Block a user