diff --git a/docs/scripts/generate-schema.js b/docs/scripts/generate-schema.js index 46cb6878..1aac5996 100644 --- a/docs/scripts/generate-schema.js +++ b/docs/scripts/generate-schema.js @@ -4,10 +4,13 @@ const path = require('path'); const pkgJson = require('../../package.json'); if (pkgJson?.contributes?.configuration) { + const idUrl = process.env.VERCEL_ENV === "preview" ? "https://beta.frontmatter.codes/frontmatter.schema.json" : "https://frontmatter.codes/frontmatter.schema.json"; + const schema = { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://frontmatter.codes/frontmatter.schema.json", - ...pkgJson.contributes.configuration + "$id": idUrl, + ...pkgJson.contributes.configuration, + "title": "Front Matter - Team Settings" } fs.writeFileSync(path.join(path.resolve('.'), '/public/frontmatter.schema.json'), JSON.stringify(schema, null, 2)); diff --git a/src/commands/Dashboard.ts b/src/commands/Dashboard.ts index d0674449..7b932abc 100644 --- a/src/commands/Dashboard.ts +++ b/src/commands/Dashboard.ts @@ -455,7 +455,13 @@ export class Dashboard { * @param msg */ private static postWebviewMessage(msg: { command: DashboardCommand, data?: any }) { - Dashboard.webview?.webview.postMessage(msg); + if (Dashboard.isDisposed) { + return; + } + + if (Dashboard.webview) { + Dashboard.webview?.webview.postMessage(msg); + } } /** diff --git a/src/helpers/SettingsHelper.ts b/src/helpers/SettingsHelper.ts index 93c04396..bca95304 100644 --- a/src/helpers/SettingsHelper.ts +++ b/src/helpers/SettingsHelper.ts @@ -5,13 +5,14 @@ import { SETTING_TAXONOMY_TAGS, SETTING_TAXONOMY_CATEGORIES, CONFIG_KEY } from ' import { Folders } from '../commands/Folders'; import { join, basename } from 'path'; import { existsSync, readFileSync, writeFileSync } from 'fs'; +import { Extension } from './Extension'; export class Settings { private static config: vscode.WorkspaceConfiguration; private static globalFile = "frontmatter.json"; private static globalConfig: any; private static initialConfig = { - "$schema": "https://frontmatter.codes/frontmatter.schema.json" + "$schema": `https://${Extension.getInstance().isBetaVersion() ? `beta.` : ``}frontmatter.codes/frontmatter.schema.json` }; public static init() {