diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml index 08afa9ae..e3765489 100644 --- a/.github/workflows/release-beta.yml +++ b/.github/workflows/release-beta.yml @@ -13,8 +13,8 @@ jobs: name: Beta steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 18 registry-url: https://registry.npmjs.org/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27861b5f..17d55cc1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,8 +13,8 @@ jobs: name: Stable steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 18 registry-url: https://registry.npmjs.org/ diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6e33ab..6ec33d09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,18 @@ ### ✨ New features - [#731](https://github.com/estruyf/vscode-front-matter/issues/731): Added the ability to map/unmap taxonomy to multiple pages at once +- [#746](https://github.com/estruyf/vscode-front-matter/issues/746): Placeholder support added to to the `slug` field - [#749](https://github.com/estruyf/vscode-front-matter/issues/749): Ability to set your own filters on the content dashboard with the `frontMatter.content.filters` setting ### 🎨 Enhancements +- [#673](https://github.com/estruyf/vscode-front-matter/pull/673): Added git settings to the welcome view and settings view - [#727](https://github.com/estruyf/vscode-front-matter/pull/727): Updated Japanese translations thanks to [mayumihara](https://github.com/mayumih387) - [#737](https://github.com/estruyf/vscode-front-matter/issues/737): Optimize the grid layout of the content and media dashboards +- [#739](https://github.com/estruyf/vscode-front-matter/pull/739): New Git settings to disable and require a commit message - [#741](https://github.com/estruyf/vscode-front-matter/issues/741): Added message on the content dashboard when content is processed - [#747](https://github.com/estruyf/vscode-front-matter/issues/747): The `@frontmatter/extensibility` dependency now supports scripts for placeholders +- [#752](https://github.com/estruyf/vscode-front-matter/issues/752): Placeholder support in default `list` field values ### ⚡️ Optimizations diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 3ee4a2e7..39e98d97 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -50,6 +50,11 @@ "settings.diagnostic": "Diagnostic", "settings.diagnostic.description": "You can run the diagnostics to check the whole Front Matter CMS configuration.", "settings.diagnostic.link": "Run full diagnostics", + "settings.git": "Git synchronization", + "settings.git.enabled": "Enable Git synchronization to easily sync your changes with your repository.", + "settings.git.commitMessage": "Commit message", + "settings.git.submoduleInfo": "When working with Git submodules, you can refer to the submodule settings in the documentation.", + "settings.git.submoduleLink": "Read more about Git submodules", "settings.commonSettings.website.title": "Website and SSG settings", "settings.commonSettings.previewUrl": "Preview URL", @@ -278,6 +283,8 @@ "dashboard.steps.stepsToGetStarted.contentFolders.information.description": "You can also perform this action by right-clicking on the folder in the explorer view, and selecting register folder", "dashboard.steps.stepsToGetStarted.tags.name": "Import all tags and categories (optional)", "dashboard.steps.stepsToGetStarted.tags.description": "Now that Front Matter knows all the content folders. Would you like to import all tags and categories from the available content?", + "dashboard.steps.stepsToGetStarted.git.name": "Do you want to enable Git synchronization?", + "dashboard.steps.stepsToGetStarted.git.description": "Enable Git synchronization to eaily sync your changes with your repository.", "dashboard.steps.stepsToGetStarted.showDashboard.name": "Show the dashboard", "dashboard.steps.stepsToGetStarted.showDashboard.description": "Once all actions are completed, the dashboard can be loaded.", "dashboard.steps.stepsToGetStarted.template.name": "Use a configuration template", @@ -332,6 +339,10 @@ "dashboard.configuration.astro.astroContentTypes.empty": "No Astro Content Collections found.", "dashboard.configuration.astro.astroContentTypes.description": "The following Astro Content Collections can be used to generate a content-type.", + "panel.git.gitAction.title": "Publish changes", + "panel.git.gitAction.input.placeholder": "Commit message", + "panel.git.gitAction.button.fetch": "Fetch", + "panel.contentType.contentTypeValidator.title": "Content-type", "panel.contentType.contentTypeValidator.hint": "We noticed field differences between the content-type and the front matter data. \n Would you like to create, update, or set the content-type for this content?", "panel.contentType.contentTypeValidator.button.create": "Create content-type", diff --git a/package-lock.json b/package-lock.json index 54476200..2cd78a77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@actions/core": "^1.10.0", "@bendera/vscode-webview-elements": "0.6.2", "@estruyf/vscode": "^1.1.0", - "@headlessui/react": "^1.7.17", + "@headlessui/react": "^1.7.18", "@heroicons/react": "^2.1.1", "@iarna/toml": "2.2.3", "@octokit/rest": "^18.12.0", diff --git a/package.json b/package.json index 3f45a72c..b3c47b9e 100644 --- a/package.json +++ b/package.json @@ -887,6 +887,22 @@ "markdownDescription": "%setting.frontMatter.git.commitMessage.markdownDescription%", "default": "Synced by Front Matter" }, + "frontMatter.git.disableOnBranches": { + "type": "array", + "markdownDescription": "%setting.frontMatter.git.disableOnBranches.markdownDescription%", + "default": [], + "items": { + "type": "string" + } + }, + "frontMatter.git.requiresCommitMessage": { + "type": "array", + "markdownDescription": "%setting.frontMatter.git.requiresCommitMessage.markdownDescription%", + "default": [], + "items": { + "type": "string" + } + }, "frontMatter.git.submodule.pull": { "type": "boolean", "markdownDescription": "%setting.frontMatter.git.submodule.pull.markdownDescription%", @@ -1654,6 +1670,14 @@ "default": null, "description": "%setting.frontMatter.taxonomy.contentTypes.items.properties.previewPath.description%" }, + "slugTemplate": { + "type": [ + "null", + "string" + ], + "default": null, + "description": "%setting.frontMatter.content.pageFolders.items.properties.slugTemplate.description%" + }, "template": { "type": "string", "default": "", @@ -1892,6 +1916,11 @@ "markdownDescription": "%setting.frontMatter.taxonomy.slugSuffix.markdownDescription%", "scope": "Taxonomy" }, + "frontMatter.taxonomy.slugTemplate": { + "type": "string", + "markdownDescription": "%setting.frontMatter.taxonomy.slugTemplate.markdownDescription%", + "scope": "Taxonomy" + }, "frontMatter.taxonomy.tags": { "type": "array", "markdownDescription": "%setting.frontMatter.taxonomy.tags.markdownDescription%", @@ -2610,7 +2639,7 @@ "@actions/core": "^1.10.0", "@bendera/vscode-webview-elements": "0.6.2", "@estruyf/vscode": "^1.1.0", - "@headlessui/react": "^1.7.17", + "@headlessui/react": "^1.7.18", "@heroicons/react": "^2.1.1", "@iarna/toml": "2.2.3", "@octokit/rest": "^18.12.0", diff --git a/package.nls.json b/package.nls.json index 7c22f73a..c5fa5524 100644 --- a/package.nls.json +++ b/package.nls.json @@ -211,6 +211,7 @@ "setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.when.properties.caseSensitive.description": "Specify if the comparison is case sensitive. Default: true", "setting.frontMatter.taxonomy.contentTypes.items.properties.pageBundle.description": "Specify if you want to create a folder when creating new content.", "setting.frontMatter.taxonomy.contentTypes.items.properties.previewPath.description": "Defines a custom preview path for the content type.", + "setting.frontMatter.taxonomy.contentTypes.items.properties.slugTemplate.description": "Defines a custom slug template for the content type.", "setting.frontMatter.taxonomy.contentTypes.items.properties.template.description": "An optional template that can be used for creating new content.", "setting.frontMatter.taxonomy.contentTypes.items.properties.postScript.description": "An optional post script that can be used after new content creation.", "setting.frontMatter.taxonomy.contentTypes.items.properties.filePrefix.description": "Defines a prefix for the file name.", @@ -237,6 +238,7 @@ "setting.frontMatter.taxonomy.seoTitleLength.markdownDescription": "Specifies the optimal title length for SEO (set to `-1` to turn it off). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.seotitlelength)", "setting.frontMatter.taxonomy.slugPrefix.markdownDescription": "Specify a prefix for the slug. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugprefix)", "setting.frontMatter.taxonomy.slugSuffix.markdownDescription": "Specify a suffix for the slug. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugsuffix)", + "setting.frontMatter.taxonomy.slugTemplate.markdownDescription": "Defines a custom slug template for the content you will create. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.slugtemplate)", "setting.frontMatter.taxonomy.tags.markdownDescription": "Specifies the tags which can be used in the Front Matter. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.taxonomy.tags)", "setting.frontMatter.telemetry.disable.markdownDescription": "Specify if you want to disable the telemetry. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.telemetry.disable)", "setting.frontMatter.templates.enabled.markdownDescription": "Specify if you want to use templates. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.templates.enabled)", @@ -251,5 +253,8 @@ "command.frontMatter.settings.refresh": "Refresh Front Matter Settings", "setting.frontMatter.config.dynamicFilePath.markdownDescription": "Specify the path to the dynamic config file (ex: [[workspace]]/config.js). [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.config.dynamicfilepath)", "setting.frontMatter.taxonomy.contentTypes.items.properties.allowAsSubContent.description": "Specify if the content type can be used as sub content.", - "setting.frontMatter.taxonomy.contentTypes.items.properties.isSubContent.description": "Specify if the content type is sub content." + "setting.frontMatter.taxonomy.contentTypes.items.properties.isSubContent.description": "Specify if the content type is sub content.", + + "setting.frontMatter.git.disableOnBranches.markdownDescription": "Specify the branches on which you want to disable the Git actions. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.disableonbranches)", + "setting.frontMatter.git.requiresCommitMessage.markdownDescription": "Specify if you want to require a commit message when publishing your changes for a specified branch. [Check in the docs](https://frontmatter.codes/docs/settings/overview#frontmatter.git.requirescommitmessage)" } \ No newline at end of file diff --git a/src/commands/Article.ts b/src/commands/Article.ts index ca2ad508..b4aad4dc 100644 --- a/src/commands/Article.ts +++ b/src/commands/Article.ts @@ -15,18 +15,23 @@ import { import * as vscode from 'vscode'; import { CustomPlaceholder, Field } from '../models'; import { format } from 'date-fns'; -import { ArticleHelper, Settings, SlugHelper } from '../helpers'; +import { + ArticleHelper, + Settings, + SlugHelper, + processArticlePlaceholdersFromData, + processTimePlaceholders +} from '../helpers'; import { Notifications } from '../helpers/Notifications'; import { extname, basename, parse, dirname } from 'path'; import { COMMAND_NAME, DefaultFields } from '../constants'; -import { DashboardData, SnippetRange } from '../models/DashboardData'; +import { DashboardData, SnippetInfo, SnippetRange } from '../models/DashboardData'; import { DateHelper } from '../helpers/DateHelper'; import { parseWinPath } from '../helpers/parseWinPath'; import { Telemetry } from '../helpers/Telemetry'; import { ParsedFrontMatter } from '../parsers'; import { MediaListener } from '../listeners/panel'; import { NavigationType } from '../dashboardWebView/models'; -import { processKnownPlaceholders } from '../helpers/PlaceholderHelper'; import { Position } from 'vscode'; import { SNIPPET } from '../constants/Snippet'; import * as l10n from '@vscode/l10n'; @@ -124,7 +129,7 @@ export class Article { /** * Generate the new slug */ - public static generateSlug(title: string) { + public static generateSlug(title: string, article?: ParsedFrontMatter, slugTemplate?: string) { if (!title) { return; } @@ -132,13 +137,15 @@ export class Article { const prefix = Settings.get(SETTING_SLUG_PREFIX) as string; const suffix = Settings.get(SETTING_SLUG_SUFFIX) as string; - const slug = SlugHelper.createSlug(title); + if (article?.data) { + const slug = SlugHelper.createSlug(title, article?.data, slugTemplate); - if (slug) { - return { - slug, - slugWithPrefixAndSuffix: `${prefix}${slug}${suffix}` - }; + if (slug) { + return { + slug, + slugWithPrefixAndSuffix: `${prefix}${slug}${suffix}` + }; + } } return undefined; @@ -168,7 +175,7 @@ export class Article { const titleField = 'title'; const articleTitle: string = article.data[titleField]; - const slugInfo = Article.generateSlug(articleTitle); + const slugInfo = Article.generateSlug(articleTitle, article, contentType.slugTemplate); if (slugInfo && slugInfo.slug && slugInfo.slugWithPrefixAndSuffix) { article.data['slug'] = slugInfo.slugWithPrefixAndSuffix; @@ -192,9 +199,13 @@ export class Article { ); for (const pField of customPlaceholderFields) { article.data[pField.name] = customPlaceholder.value; - article.data[pField.name] = processKnownPlaceholders( + article.data[pField.name] = processArticlePlaceholdersFromData( + article.data[pField.name], + article.data, + contentType + ); + article.data[pField.name] = processTimePlaceholders( article.data[pField.name], - articleTitle, dateFormat ); } @@ -388,7 +399,7 @@ export class Article { snippetStartBeforePos = linesBeforeSelection.length - snippetStartBeforePos - 1; } - let snippetInfo: { id: string; fields: any[] } | undefined = undefined; + let snippetInfo: SnippetInfo | undefined = undefined; let range: SnippetRange | undefined = undefined; if ( snippetEndAfterPos > -1 && @@ -412,6 +423,7 @@ export class Article { } const article = ArticleHelper.getFrontMatter(editor); + const contentType = article ? ArticleHelper.getContentType(article) : undefined; await vscode.commands.executeCommand(COMMAND_NAME.dashboard, { type: NavigationType.Snippets, @@ -419,6 +431,7 @@ export class Article { fileTitle: article?.data.title || '', filePath: editor.document.uri.fsPath, fieldName: basename(editor.document.uri.fsPath), + contentType, position, range, selection: selectionText, diff --git a/src/commands/Dashboard.ts b/src/commands/Dashboard.ts index 7b5001bb..41e7dd5c 100644 --- a/src/commands/Dashboard.ts +++ b/src/commands/Dashboard.ts @@ -3,11 +3,13 @@ import { CONTEXT, ExtensionState, SETTING_EXPERIMENTAL, - SETTING_EXTENSIBILITY_SCRIPTS + SETTING_EXTENSIBILITY_SCRIPTS, + COMMAND_NAME, + TelemetryEvent } from '../constants'; import { join } from 'path'; import { commands, Uri, ViewColumn, Webview, WebviewPanel, window } from 'vscode'; -import { DashboardSettings, Logger, Settings as SettingsHelper } from '../helpers'; +import { DashboardSettings, Logger, Settings as SettingsHelper, Telemetry } from '../helpers'; import { DashboardCommand } from '../dashboardWebView/DashboardCommand'; import { Extension } from '../helpers/Extension'; import { WebviewHelper } from '@estruyf/vscode'; @@ -31,6 +33,8 @@ import { GitListener, ModeListener } from '../listeners/general'; import { Folders } from './Folders'; import * as l10n from '@vscode/l10n'; import { LocalizationKey } from '../localization'; +import { DashboardMessage } from '../dashboardWebView/DashboardMessage'; +import { NavigationType } from '../dashboardWebView/models'; export class Dashboard { private static webview: WebviewPanel | null = null; @@ -51,6 +55,56 @@ export class Dashboard { } } + public static registerCommands() { + const subscriptions = Extension.getInstance().subscriptions; + + subscriptions.push( + commands.registerCommand(COMMAND_NAME.dashboard, (data?: DashboardData) => { + Telemetry.send(TelemetryEvent.openContentDashboard); + if (!data) { + Dashboard.open({ type: NavigationType.Contents }); + } else { + Dashboard.open(data); + } + }) + ); + + subscriptions.push( + commands.registerCommand(COMMAND_NAME.dashboardMedia, () => { + Telemetry.send(TelemetryEvent.openMediaDashboard); + Dashboard.open({ type: NavigationType.Media }); + }) + ); + + subscriptions.push( + commands.registerCommand(COMMAND_NAME.dashboardSnippets, () => { + Telemetry.send(TelemetryEvent.openSnippetsDashboard); + Dashboard.open({ type: NavigationType.Snippets }); + }) + ); + + subscriptions.push( + commands.registerCommand(COMMAND_NAME.dashboardData, () => { + Telemetry.send(TelemetryEvent.openDataDashboard); + Dashboard.open({ type: NavigationType.Data }); + }) + ); + + subscriptions.push( + commands.registerCommand(COMMAND_NAME.dashboardTaxonomy, () => { + Telemetry.send(TelemetryEvent.openTaxonomyDashboard); + Dashboard.open({ type: NavigationType.Taxonomy }); + }) + ); + + subscriptions.push( + commands.registerCommand(COMMAND_NAME.dashboardClose, () => { + Telemetry.send(TelemetryEvent.closeDashboard); + Dashboard.close(); + }) + ); + } + /** * Open or reveal the dashboard */ @@ -204,7 +258,7 @@ export class Dashboard { * @param msg */ public static postWebviewMessage(msg: { - command: DashboardCommand; + command: DashboardCommand | DashboardMessage; requestId?: string; payload?: unknown; error?: unknown; diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index 9059ba02..7d1f4a16 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -13,7 +13,7 @@ import { ContentFolder, FileInfo, FolderInfo, StaticFolder } from '../models'; import uniqBy = require('lodash.uniqby'); import { Template } from './Template'; import { Notifications } from '../helpers/Notifications'; -import { Logger, processKnownPlaceholders, Settings } from '../helpers'; +import { Logger, Settings, processTimePlaceholders } from '../helpers'; import { existsSync } from 'fs'; import { format } from 'date-fns'; import { Dashboard } from './Dashboard'; @@ -377,7 +377,7 @@ export class Folders { let folderPath: string | undefined = Folders.absWsFolder(folder, wsFolder); if (folderPath.includes(`{{`) && folderPath.includes(`}}`)) { const dateFormat = Settings.get(SETTING_DATE_FORMAT) as string; - folderPath = processKnownPlaceholders(folderPath, undefined, dateFormat); + folderPath = processTimePlaceholders(folderPath, dateFormat); } else { if (folderPath && !existsSync(folderPath)) { Notifications.errorShowOnce( diff --git a/src/commands/Preview.ts b/src/commands/Preview.ts index 18d05571..f0252f1d 100644 --- a/src/commands/Preview.ts +++ b/src/commands/Preview.ts @@ -14,7 +14,7 @@ import { import { ArticleHelper } from './../helpers/ArticleHelper'; import { join, parse } from 'path'; import { commands, env, Uri, ViewColumn, window, WebviewPanel, extensions } from 'vscode'; -import { Extension, parseWinPath, processKnownPlaceholders, Settings } from '../helpers'; +import { Extension, parseWinPath, processTimePlaceholders, Settings } from '../helpers'; import { ContentFolder, ContentType, PreviewSettings } from '../models'; import { format } from 'date-fns'; import { DateHelper } from '../helpers/DateHelper'; @@ -294,7 +294,7 @@ export class Preview { if (pathname) { // Known placeholders const dateFormat = Settings.get(SETTING_DATE_FORMAT) as string; - pathname = processKnownPlaceholders(pathname, article?.data?.title, dateFormat); + pathname = processTimePlaceholders(pathname, dateFormat); // Custom placeholders pathname = await ArticleHelper.processCustomPlaceholders( @@ -318,7 +318,7 @@ export class Preview { } // Support front matter placeholders - {{fm.}} - pathname = processFmPlaceholders(pathname, article?.data); + pathname = article?.data ? processFmPlaceholders(pathname, article?.data) : pathname; try { const articleDate = ArticleHelper.getDate(article); diff --git a/src/constants/GeneralCommands.ts b/src/constants/GeneralCommands.ts index ccb77129..e761c335 100644 --- a/src/constants/GeneralCommands.ts +++ b/src/constants/GeneralCommands.ts @@ -1,13 +1,22 @@ export const GeneralCommands = { toWebview: { setMode: 'setMode', - gitSyncingStart: 'gitSyncingStart', - gitSyncingEnd: 'gitSyncingEnd', + git: { + syncingStart: 'gitSyncingStart', + syncingEnd: 'gitSyncingEnd', + branchName: 'gitBranchName' + }, setLocalization: 'setLocalization' }, toVSCode: { openLink: 'openLink', - gitSync: 'gitSync', + git: { + isRepo: 'gitIsRepo', + sync: 'gitSync', + fetch: 'getFetch', + getBranch: 'getBranch', + selectBranch: 'gitSelectBranch' + }, getLocalization: 'getLocalization', openOnWebsite: 'openOnWebsite' } diff --git a/src/constants/Git.ts b/src/constants/Git.ts new file mode 100644 index 00000000..0d9dfd69 --- /dev/null +++ b/src/constants/Git.ts @@ -0,0 +1,3 @@ +export const GIT_CONFIG = { + defaultCommitMessage: 'Synced by Front Matter' +}; diff --git a/src/constants/Links.ts b/src/constants/Links.ts index 72c07f04..1bea4ebe 100644 --- a/src/constants/Links.ts +++ b/src/constants/Links.ts @@ -8,3 +8,5 @@ export const DOCUMENTATION_SETTINGS_LINK = 'https://frontmatter.codes/docs/setti export const SENTRY_LINK = 'https://1ac45704bbe74264a7b4674bdc2abf48@o1022172.ingest.sentry.io/5988293'; + +export const DOCS_SUBMODULES = 'https://frontmatter.codes/docs/git-integration#git-submodules'; diff --git a/src/constants/TelemetryEvent.ts b/src/constants/TelemetryEvent.ts index e4a1dbc1..f717da6f 100644 --- a/src/constants/TelemetryEvent.ts +++ b/src/constants/TelemetryEvent.ts @@ -49,5 +49,6 @@ export const TelemetryEvent = { webviewTaxonomyDashboard: 'webviewTaxonomyDashboard', // Git - gitSync: 'gitSync' + gitSync: 'gitSync', + gitFetch: 'gitFetch' }; diff --git a/src/constants/index.ts b/src/constants/index.ts index ca2aea05..ee247c3b 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -7,6 +7,7 @@ export * from './ExtensionState'; export * from './Features'; export * from './FrameworkDetectors'; export * from './GeneralCommands'; +export * from './Git'; export * from './Links'; export * from './LocalStore'; export * from './Navigation'; diff --git a/src/constants/settings.ts b/src/constants/settings.ts index 4acb29b4..f5eff577 100644 --- a/src/constants/settings.ts +++ b/src/constants/settings.ts @@ -25,6 +25,7 @@ export const SETTING_TAXONOMY_CONTENT_TYPES = 'taxonomy.contentTypes'; export const SETTING_SLUG_PREFIX = 'taxonomy.slugPrefix'; export const SETTING_SLUG_SUFFIX = 'taxonomy.slugSuffix'; +export const SETTING_SLUG_TEMPLATE = 'taxonomy.slugTemplate'; export const SETTING_SLUG_UPDATE_FILE_NAME = 'taxonomy.alignFilename'; export const SETTING_INDENT_ARRAY = 'taxonomy.indentArrays'; @@ -100,6 +101,8 @@ export const SETTING_FRAMEWORK_START = 'framework.startCommand'; export const SETTING_SITE_BASEURL = 'site.baseURL'; export const SETTING_GIT_ENABLED = 'git.enabled'; +export const SETTING_GIT_DISABLED_BRANCHES = 'git.disableOnBranches'; +export const SETTING_GIT_REQUIRES_COMMIT_MSG = 'git.requiresCommitMessage'; export const SETTING_GIT_COMMIT_MSG = 'git.commitMessage'; export const SETTING_GIT_SUBMODULE_PULL = 'git.submodule.pull'; export const SETTING_GIT_SUBMODULE_PUSH = 'git.submodule.push'; diff --git a/src/dashboardWebView/DashboardMessage.ts b/src/dashboardWebView/DashboardMessage.ts index 9aa31534..7d658e9f 100644 --- a/src/dashboardWebView/DashboardMessage.ts +++ b/src/dashboardWebView/DashboardMessage.ts @@ -54,6 +54,7 @@ export enum DashboardMessage { insertSnippet = 'insertSnippet', addSnippet = 'addSnippet', updateSnippet = 'updateSnippet', + updateSnippetPlaceholders = 'updateSnippetPlaceholders', // Taxonomy dashboard getTaxonomyData = 'getTaxonomyData', diff --git a/src/dashboardWebView/components/Header/Header.tsx b/src/dashboardWebView/components/Header/Header.tsx index c90e9c3c..bf1a45e2 100644 --- a/src/dashboardWebView/components/Header/Header.tsx +++ b/src/dashboardWebView/components/Header/Header.tsx @@ -164,7 +164,7 @@ export const Header: React.FunctionComponent = ({
- + {/* */} = ( const [isSyncing, setIsSyncing] = useState(false); const pull = () => { - Messenger.send(GeneralCommands.toVSCode.gitSync); + Messenger.send(GeneralCommands.toVSCode.git.sync); }; const messageListener = (message: MessageEvent>) => { const { command } = message.data; - if (command === GeneralCommands.toWebview.gitSyncingStart) { + if (command === GeneralCommands.toWebview.git.syncingStart) { setIsSyncing(true); - } else if (command === GeneralCommands.toWebview.gitSyncingEnd) { + } else if (command === GeneralCommands.toWebview.git.syncingEnd) { setIsSyncing(false); } }; diff --git a/src/dashboardWebView/components/Media/Item.tsx b/src/dashboardWebView/components/Media/Item.tsx index ca8168be..3557dc1f 100644 --- a/src/dashboardWebView/components/Media/Item.tsx +++ b/src/dashboardWebView/components/Media/Item.tsx @@ -42,10 +42,12 @@ import { LocalizationKey } from '../../../localization'; export interface IItemProps { media: MediaInfo; + index: number; } export const Item: React.FunctionComponent = ({ - media + media, + index }: React.PropsWithChildren) => { const [, setLightbox] = useRecoilState(LightboxAtom); const [showAlert, setShowAlert] = useState(false); @@ -66,7 +68,7 @@ export const Item: React.FunctionComponent = ({ const [referenceElement, setReferenceElement] = useState(null); const [popperElement, setPopperElement] = useState(null); - const { styles, attributes } = usePopper(referenceElement, popperElement, { + const { styles, attributes, update } = usePopper(referenceElement, popperElement, { placement: 'bottom-end', strategy: 'fixed' }); @@ -400,6 +402,12 @@ export const Item: React.FunctionComponent = ({ setMediaData(undefined); }; + useEffect(() => { + if (update) { + update(); + } + }, [update, index]); + useEffect(() => { const name = basename(parseWinPath(media.fsPath) || ''); if (name !== filename) { diff --git a/src/dashboardWebView/components/Media/Media.tsx b/src/dashboardWebView/components/Media/Media.tsx index 823830cb..cfab4915 100644 --- a/src/dashboardWebView/components/Media/Media.tsx +++ b/src/dashboardWebView/components/Media/Media.tsx @@ -250,8 +250,8 @@ export const Media: React.FunctionComponent = ( )} - {allMedia.map((file) => ( - + {allMedia.map((file, idx) => ( + ))}
diff --git a/src/dashboardWebView/components/Menu/ActionMenuButton.tsx b/src/dashboardWebView/components/Menu/ActionMenuButton.tsx index 641056f6..96c0e526 100644 --- a/src/dashboardWebView/components/Menu/ActionMenuButton.tsx +++ b/src/dashboardWebView/components/Menu/ActionMenuButton.tsx @@ -18,8 +18,7 @@ export const ActionMenuButton: React.FunctionComponent = ref={ref || null} onClick={(e: React.MouseEvent) => e.stopPropagation()} disabled={disabled} - className={`group inline-flex justify-center text-sm font-medium text-[var(--vscode-tab-inactiveForeground)] hover:text-[var(--vscode-tab-activeForeground)] ${disabled ? 'opacity-50' : '' - }`} + className={`group inline-flex justify-center text-sm font-medium text-[var(--vscode-tab-inactiveForeground)] hover:text-[var(--vscode-tab-activeForeground)] ${disabled ? 'opacity-50' : ''}`} > {title}