diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a0b726b..59604a7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## [8.1.1] - 2022-09-23 + +### 🐞 Fixes + +- [#422](https://github.com/estruyf/vscode-front-matter/issues/422): Fix in panel initialization logic + ## [8.1.0] - 2022-09-22 - [Release notes](https://beta.frontmatter.codes/updates/v8.1.0) ### ✨ New features diff --git a/README.beta.md b/README.beta.md index c06d063f..1a461828 100644 --- a/README.beta.md +++ b/README.beta.md @@ -54,6 +54,12 @@ A couple of our extension highlights that hopefully get you interested in giving > If you see something missing in your article creation flow, please feel free to reach out. +**Version 8** + +The taxonomy dashboard got introduced on which you can manage your tags, categories, and custom taxonomy. + +![Taxonomy dashboard](https://beta.frontmatter.codes/assets/marketplace/v8.1.0/taxonomy-dashboard.png) + **Version 7** Snippets support for Front Matter has been added! diff --git a/README.md b/README.md index 5fa74215..1da49a36 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,12 @@ A couple of our extension highlights that hopefully get you interested in giving > If you see something missing in your article creation flow, please feel free to reach out. +**Version 8** + +The taxonomy dashboard got introduced on which you can manage your tags, categories, and custom taxonomy. + +![Taxonomy dashboard](https://frontmatter.codes/assets/marketplace/v8.1.0/taxonomy-dashboard.png) + **Version 7** Snippets support for Front Matter has been added! diff --git a/assets/media/styles.css b/assets/media/styles.css index bc23546c..f9c9f15c 100644 --- a/assets/media/styles.css +++ b/assets/media/styles.css @@ -42,7 +42,8 @@ .collapsible__body, .ext_settings, -.git_actions { +.git_actions, +.initialize_actions { padding: 1rem 1.25rem; box-sizing: border-box; } diff --git a/src/commands/Template.ts b/src/commands/Template.ts index a43c56b0..03b6119c 100644 --- a/src/commands/Template.ts +++ b/src/commands/Template.ts @@ -6,9 +6,7 @@ import { SETTING_CONTENT_DEFAULT_FILETYPE, SETTING_TEMPLATES_FOLDER, TelemetryEv import { ArticleHelper, Settings } from '../helpers'; import { Article } from '.'; import { Notifications } from '../helpers/Notifications'; -import { CONTEXT } from '../constants'; import { Project } from './Project'; -import { Folders } from './Folders'; import { ContentType } from '../helpers/ContentType'; import { ContentType as IContentType } from '../models'; import { PagesListener } from '../listeners/dashboard'; @@ -17,39 +15,6 @@ import { Telemetry } from '../helpers/Telemetry'; export class Template { - /** - * Check if the template folder is available - */ - public static async init() { - const isInitialized = await Template.isInitialized(); - await vscode.commands.executeCommand('setContext', CONTEXT.canInit, !isInitialized); - - if (isInitialized) { - await vscode.commands.executeCommand('setContext', CONTEXT.initialized, true); - } - } - - /** - * Check if the project is already initialized - */ - public static async isInitialized() { - const wsFolder = Folders.getWorkspaceFolder(); - const folder = Template.getSettings(); - - if (!folder || !wsFolder) { - return false; - } - - const templatePath = vscode.Uri.file(path.join(wsFolder.fsPath, folder)); - - try { - await vscode.workspace.fs.stat(templatePath); - return true; - } catch (e) { - return false; - } - } - /** * Generate a template */ diff --git a/src/constants/context.ts b/src/constants/context.ts index 4878599d..14436283 100644 --- a/src/constants/context.ts +++ b/src/constants/context.ts @@ -1,6 +1,4 @@ export const CONTEXT = { - canInit: "frontMatter:CanInit", - initialized: "frontMatter:Initialized", canOpenPreview: "frontMatter:CanOpenPreview", canOpenDashboard: "frontMatter:CanOpenDashboard", isEnabled: "frontMatter:enabled", diff --git a/src/extension.ts b/src/extension.ts index 84cd562d..aa5317a3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -182,14 +182,15 @@ export async function activate(context: vscode.ExtensionContext) { ); // Initialize command - Template.init(); - const projectInit = vscode.commands.registerCommand(COMMAND_NAME.init, async (cb: Function) => { - await Project.init(); + subscriptions.push( + vscode.commands.registerCommand(COMMAND_NAME.init, async (cb: Function) => { + await Project.init(); - if (cb) { - cb(); - } - }); + if (cb) { + cb(); + } + }) + ); // Settings promotion command subscriptions.push(vscode.commands.registerCommand(COMMAND_NAME.promote, SettingsHelper.promote)); @@ -201,7 +202,6 @@ export async function activate(context: vscode.ExtensionContext) { // Things to do when configuration changes SettingsHelper.onConfigChange((global?: any) => { - Template.init(); Preview.init(); GitListener.init(); @@ -285,7 +285,6 @@ export async function activate(context: vscode.ExtensionContext) { createContent, createByContentType, createByTemplate, - projectInit, collapseAll, createFolder ); diff --git a/src/helpers/PanelSettings.ts b/src/helpers/PanelSettings.ts index cec43fe9..ea20e95f 100644 --- a/src/helpers/PanelSettings.ts +++ b/src/helpers/PanelSettings.ts @@ -2,7 +2,7 @@ import { workspace } from "vscode" import { Extension, Settings } from "." import { Dashboard } from "../commands/Dashboard" import { Preview } from "../commands/Preview" -import { Template } from "../commands/Template" +import { Project } from "../commands/Project" import { CONTEXT, DefaultFields, SETTING_CONTENT_DRAFT_FIELD, SETTING_CONTENT_FRONTMATTER_HIGHLIGHT, SETTING_DATA_TYPES, SETTING_FRAMEWORK_ID, SETTING_FRAMEWORK_START, SETTING_AUTO_UPDATE_DATE, SETTING_COMMA_SEPARATED_FIELDS, SETTING_CUSTOM_SCRIPTS, SETTING_DATE_FORMAT, SETTING_PANEL_FREEFORM, SETTING_SEO_CONTENT_MIN_LENGTH, SETTING_SEO_DESCRIPTION_FIELD, SETTING_SEO_DESCRIPTION_LENGTH, SETTING_SEO_SLUG_LENGTH, SETTING_SEO_TITLE_LENGTH, SETTING_SLUG_PREFIX, SETTING_SLUG_SUFFIX, SETTING_SLUG_UPDATE_FILE_NAME, SETTING_TAXONOMY_CATEGORIES, SETTING_TAXONOMY_CONTENT_TYPES, SETTING_TAXONOMY_CUSTOM, SETTING_TAXONOMY_FIELD_GROUPS, SETTING_TAXONOMY_TAGS, SETTING_GIT_ENABLED } from "../constants" import { GitListener } from "../listeners/general" import { CustomScript, DataType, DraftField, FieldGroup, PanelSettings as IPanelSettings, ScriptType } from "../models" @@ -37,7 +37,7 @@ export class PanelSettings { customTaxonomy: Settings.get(SETTING_TAXONOMY_CUSTOM, true) || [], freeform: Settings.get(SETTING_PANEL_FREEFORM), scripts: (Settings.get(SETTING_CUSTOM_SCRIPTS) || []).filter(s => (s.type === ScriptType.Content || !s.type) && !s.hidden), - isInitialized: await Template.isInitialized(), + isInitialized: Project.isInitialized(), modifiedDateUpdate: Settings.get(SETTING_AUTO_UPDATE_DATE) || false, writingSettingsEnabled: this.isWritingSettingsEnabled() || false, fmHighlighting: Settings.get(SETTING_CONTENT_FRONTMATTER_HIGHLIGHT), diff --git a/src/helpers/Questions.ts b/src/helpers/Questions.ts index e936fd94..182be966 100644 --- a/src/helpers/Questions.ts +++ b/src/helpers/Questions.ts @@ -55,8 +55,11 @@ export class Questions { placeHolder: `Select where you want to create your content`, ignoreFocusOut: true }); - } else { + } else if (folders.length === 1) { selectedFolder = folders[0].title; + } else { + Notifications.warning(`No page folders were configures.`); + return; } if (!selectedFolder && showWarning) { diff --git a/src/listeners/panel/ExtensionListener.ts b/src/listeners/panel/ExtensionListener.ts index 5061744c..93064c15 100644 --- a/src/listeners/panel/ExtensionListener.ts +++ b/src/listeners/panel/ExtensionListener.ts @@ -47,8 +47,7 @@ export class ExtensionListener extends BaseListener { * Initialize project */ private static async initialize() { - await commands.executeCommand(COMMAND_NAME.init); - SettingsListener.getSettings(); + await commands.executeCommand(COMMAND_NAME.dashboard); } /** diff --git a/src/panelWebView/components/BaseView.tsx b/src/panelWebView/components/BaseView.tsx index abf00592..a6e1b607 100644 --- a/src/panelWebView/components/BaseView.tsx +++ b/src/panelWebView/components/BaseView.tsx @@ -45,32 +45,43 @@ const BaseView: React.FunctionComponent = ({settings, folderAndF return (
- - - - - - - - -
- - - - { - !settings?.isInitialized && - } - - - - { - customActions.map((script) => ( - - )) - } + { + !settings?.isInitialized && ( +
+
- - + ) + } + + { + settings?.isInitialized && ( + <> + + + + + + + + +
+ + + + + + + { + customActions.map((script) => ( + + )) + } +
+
+
+ + ) + }