diff --git a/CHANGELOG.md b/CHANGELOG.md index a2fc1fbe..f7017bae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - [#121](https://github.com/estruyf/vscode-front-matter/issues/121): Choice fields support ID/title objects as well as a regular string - [#122](https://github.com/estruyf/vscode-front-matter/issues/122): Update the filenames of your media - [#124](https://github.com/estruyf/vscode-front-matter/issues/124): Add new `isPreviewImage` property to the content type field to specify custom preview images +- [#127](https://github.com/estruyf/vscode-front-matter/issues/127): Title bar action added to open the dashboard ### 🐞 Fixes diff --git a/assets/icons/close-dark.svg b/assets/icons/close-dark.svg index 9c5818f2..257a84b0 100644 --- a/assets/icons/close-dark.svg +++ b/assets/icons/close-dark.svg @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/assets/icons/close-light.svg b/assets/icons/close-light.svg index 65e4e669..b9270b95 100644 --- a/assets/icons/close-light.svg +++ b/assets/icons/close-light.svg @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/assets/icons/frontmatter-dark.svg b/assets/icons/frontmatter-dark.svg new file mode 100644 index 00000000..dc46fe08 --- /dev/null +++ b/assets/icons/frontmatter-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/frontmatter-light.svg b/assets/icons/frontmatter-light.svg new file mode 100644 index 00000000..e53d4c64 --- /dev/null +++ b/assets/icons/frontmatter-light.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/package.json b/package.json index dbda4d0a..4a9f50aa 100644 --- a/package.json +++ b/package.json @@ -535,7 +535,8 @@ { "command": "frontMatter.dashboard", "title": "Open dashboard", - "category": "Front matter" + "category": "Front matter", + "icon": "$(preview)" }, { "command": "frontMatter.preview", @@ -561,9 +562,14 @@ "menus": { "editor/title": [ { - "when": "resourceLangId == markdown", "command": "frontMatter.insertImage", - "group": "navigation" + "group": "navigation@-99", + "when": "resourceLangId == markdown" + }, + { + "command": "frontMatter.dashboard", + "group": "navigation@-98", + "when": "frontMatter:enabled == true" } ], "explorer/context": [ diff --git a/src/constants/context.ts b/src/constants/context.ts index 1cac06a8..3adfb320 100644 --- a/src/constants/context.ts +++ b/src/constants/context.ts @@ -1,5 +1,6 @@ export const CONTEXT = { canInit: "frontMatterCanInit", canOpenPreview: "frontMatterCanOpenPreview", - canOpenDashboard: "frontMatterCanOpenDashboard" + canOpenDashboard: "frontMatterCanOpenDashboard", + isEnabled: "frontMatter:enabled" }; \ No newline at end of file diff --git a/src/helpers/SettingsHelper.ts b/src/helpers/SettingsHelper.ts index 35526850..5920d2b1 100644 --- a/src/helpers/SettingsHelper.ts +++ b/src/helpers/SettingsHelper.ts @@ -1,8 +1,8 @@ import { Notifications } from './Notifications'; -import { Uri, workspace } from 'vscode'; +import { commands, Uri, workspace } from 'vscode'; import * as vscode from 'vscode'; import { TaxonomyType } from '../models'; -import { SETTING_TAXONOMY_TAGS, SETTING_TAXONOMY_CATEGORIES, CONFIG_KEY } from '../constants'; +import { SETTING_TAXONOMY_TAGS, SETTING_TAXONOMY_CATEGORIES, CONFIG_KEY, CONTEXT } from '../constants'; import { Folders } from '../commands/Folders'; import { join, basename } from 'path'; import { existsSync, readFileSync, watch, writeFileSync } from 'fs'; @@ -18,6 +18,7 @@ export class Settings { if (fmConfig && existsSync(fmConfig)) { const localConfig = readFileSync(fmConfig, 'utf8'); Settings.globalConfig = JSON.parse(localConfig); + commands.executeCommand('setContext', CONTEXT.isEnabled, true); } else { Settings.globalConfig = undefined; }