Skip to content

Commit

Permalink
Merge pull request #886 from estruyf/beta
Browse files Browse the repository at this point in the history
PR for v10.6.0
  • Loading branch information
estruyf authored Nov 6, 2024
2 parents 6c591a9 + 5f7f847 commit f1f0e0a
Show file tree
Hide file tree
Showing 20 changed files with 237 additions and 147 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Change Log

## [10.6.0] - 2024-11-06 - [Release notes](https://beta.frontmatter.codes/updates/v10.6.0)

### 🎨 Enhancements

- [#878](https://github.com/estruyf/vscode-front-matter/issues/878): Allow the `select all` button to work on other pages when there is a selection present
- [#882](https://github.com/estruyf/vscode-front-matter/issues/882): Dynamic evaluation of the `node` executable path
- [#884](https://github.com/estruyf/vscode-front-matter/issues/884): Hide WYSIWYG actions when the file is in git diff mode

### 🐞 Fixes

- [#859](https://github.com/estruyf/vscode-front-matter/issues/859): Fix label in the data view dropdown field
- [#876](https://github.com/estruyf/vscode-front-matter/issues/876): Fix snippet type on the snippet card
- [#879](https://github.com/estruyf/vscode-front-matter/issues/879): Fix for auto updating last modified date on save
- [#885](https://github.com/estruyf/vscode-front-matter/issues/885): Fix content relationship for none i18n content

## [10.5.1] - 2024-10-23

### 🎨 Enhancements
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Front Matter CMS",
"description": "Front Matter is a CMS that runs within Visual Studio Code. It gives you the power and control of a full-blown CMS while also providing you the flexibility and speed of the static site generator of your choice like: Hugo, Jekyll, Docusaurus, NextJs, Gatsby, and many more...",
"icon": "assets/frontmatter-teal-128x128.png",
"version": "10.5.1",
"version": "10.6.0",
"preview": false,
"publisher": "eliostruyf",
"galleryBanner": {
Expand Down Expand Up @@ -31,7 +31,7 @@
"l10n": "./l10n",
"categories": [
"AI",
"Other"
"Visualization"
],
"keywords": [
"Front Matter",
Expand Down Expand Up @@ -2421,32 +2421,32 @@
"editor/title": [{
"command": "frontMatter.markup.heading",
"group": "navigation@-133",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.bold",
"group": "navigation@-132",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.italic",
"group": "navigation@-131",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.hyperlink",
"group": "navigation@-130",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.insertSnippet",
"group": "navigation@-129",
"when": "frontMatter:file:isValid == true && frontMatter:dashboard:snippets:enabled"
"when": "frontMatter:file:isValid == true && frontMatter:dashboard:snippets:enabled && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.insertMedia",
"group": "navigation@-128",
"when": "frontMatter:file:isValid == true"
"when": "frontMatter:file:isValid == true && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.i18n.createOrOpen",
Expand All @@ -2456,37 +2456,37 @@
{
"command": "frontMatter.markup.options",
"group": "navigation@-126",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.orderedlist",
"group": "1_markup@1",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.unorderedlist",
"group": "1_markup@2",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.tasklist",
"group": "1_markup@3",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.code",
"group": "1_markup@4",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.codeblock",
"group": "1_markup@5",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.markup.blockquote",
"group": "1_markup@6",
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
},
{
"command": "frontMatter.dashboard",
Expand Down
17 changes: 13 additions & 4 deletions src/commands/Article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class Article {
*
* @param subscriptions - The array of subscriptions to register the commands with.
*/
public static async registerCommands(subscriptions: unknown[]) {
public static registerCommands(subscriptions: unknown[]) {
subscriptions.push(
commands.registerCommand(COMMAND_NAME.setLastModifiedDate, Article.setLastModifiedDate)
);
Expand All @@ -66,6 +66,15 @@ export class Article {
subscriptions.push(commands.registerCommand(COMMAND_NAME.insertSnippet, Article.insertSnippet));
}

/**
* Registers event listeners for the Article class.
*
* @param subscriptions - An array to which the event listener will be added.
*/
public static registerListeners(subscriptions: unknown[]) {
subscriptions.push(workspace.onWillSaveTextDocument(Article.autoUpdate));
}

/**
* Sets the article date
*/
Expand Down Expand Up @@ -369,15 +378,15 @@ export class Article {
* Article auto updater
* @param event
*/
public static async autoUpdate(event: TextDocumentWillSaveEvent) {
public static autoUpdate(event: TextDocumentWillSaveEvent) {
const document = event.document;
if (document && ArticleHelper.isSupportedFile(document)) {
const autoUpdate = Settings.get(SETTING_AUTO_UPDATE_DATE);

// Is article located in one of the content folders
const folders = await Folders.getCachedOrFresh();
const folders = Folders.getCached();
const documentPath = parseWinPath(document.fileName);
const folder = folders.find((f) => documentPath.startsWith(f.path));
const folder = folders?.find((f) => documentPath.startsWith(f.path));
if (!folder) {
return;
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/uniforms-frontmatter/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function Select({
...props
}: SelectFieldProps) {
const multiple = fieldType === Array;

return (
<div className="autoform__select_field" {...filterDOMProps(props)}>
<LabelField label={label} id={id} required={required} />
Expand Down Expand Up @@ -84,11 +85,12 @@ function Select({
}}
ref={inputRef}
value={value ?? ''}
className='text-[var(--vscode-foreground)] bg-[var(--vscode-list-activeSelectionBackground)] rounded-[2px] active:border-transparent disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none'
style={{ width: '100%', padding: '0.5rem' }}
>
{(!!placeholder || !required || value === undefined) && !multiple && (
{(!required || value === undefined) && !multiple && (
<option value="" disabled={required} hidden={required}>
{placeholder || label}
{""}
</option>
)}

Expand Down
3 changes: 3 additions & 0 deletions src/dashboardWebView/components/Common/ItemSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export const ItemSelection: React.FunctionComponent<IItemSelectionProps> = ({
<div className={`${cssNames} group-hover:block`}>
<VSCodeCheckbox
className={show ? "" : " shadow-[0_0_3px_var(--frontmatter-border-preserve)]"}
onClick={(e) => {
e.stopPropagation();
}}
onChange={() => {
onMultiSelect(filePath);
}}
Expand Down
53 changes: 29 additions & 24 deletions src/dashboardWebView/components/Header/ActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { CommandLineIcon, PencilIcon, TrashIcon, ChevronDownIcon, XMarkIcon, Eye
import { useRecoilState, useRecoilValue } from 'recoil';
import { MultiSelectedItemsAtom, PagedItems, SelectedItemActionAtom, SelectedMediaFolderSelector, SettingsSelector } from '../../state';
import { ActionsBarItem } from './ActionsBarItem';
import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../../../localization';
import { LocalizationKey, localize } from '../../../localization';
import { Alert } from '../Modals/Alert';
import { messageHandler } from '@estruyf/vscode/dist/client';
import { DashboardMessage } from '../../DashboardMessage';
Expand Down Expand Up @@ -68,8 +67,14 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
}, [selectedFiles]);

const selectAllItems = React.useCallback(() => {
setSelectedFiles([...pagedItems]);
}, [pagedItems]);
const allSelected = [...selectedFiles, ...pagedItems];
setSelectedFiles(Array.from(new Set(allSelected)));
}, [selectedFiles, pagedItems]);

const hasAllItemsSelectedOnPage = React.useMemo(() => {
const selectedItemsOnPage = selectedFiles.filter((file) => pagedItems.includes(file));
return selectedItemsOnPage.length >= pagedItems.length;
}, [selectedFiles, pagedItems]);

const languageActions = React.useMemo(() => {
const actions: React.ReactNode[] = [];
Expand All @@ -92,7 +97,7 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
})
}}>
<LanguageIcon className={`mr-2 h-4 w-4`} aria-hidden={true} />
<span>{l10n.t(LocalizationKey.commonTranslate)}</span>
<span>{localize(LocalizationKey.commonTranslate)}</span>
</ActionsBarItem>
)

Expand All @@ -107,7 +112,7 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
className='flex items-center text-[var(--vscode-tab-inactiveForeground)] hover:text-[var(--vscode-tab-activeForeground)]'
>
<LanguageIcon className="mr-2 h-4 w-4" aria-hidden={true} />
<span>{l10n.t(LocalizationKey.commonLanguages)}</span>
<span>{localize(LocalizationKey.commonLanguages)}</span>
<ChevronDownIcon className="ml-2 h-4 w-4" aria-hidden={true} />
</DropdownMenuTrigger>

Expand Down Expand Up @@ -163,7 +168,7 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
disabled={selectedFiles.length === 0}
>
<CommandLineIcon className="mr-2 h-4 w-4" aria-hidden={true} />
<span>{l10n.t(LocalizationKey.commonScripts)}</span>
<span>{localize(LocalizationKey.commonScripts)}</span>
<ChevronDownIcon className="ml-2 h-4 w-4" aria-hidden={true} />
</DropdownMenuTrigger>

Expand Down Expand Up @@ -197,10 +202,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
<ActionsBarItem
disabled={selectedFiles.length === 0 || selectedFiles.length > 1}
onClick={viewFile}
title={l10n.t(LocalizationKey.commonView)}
title={localize(LocalizationKey.commonView)}
>
<EyeIcon className="w-4 h-4 mr-2" aria-hidden="true" />
<span>{l10n.t(LocalizationKey.commonView)}</span>
<span>{localize(LocalizationKey.commonView)}</span>
</ActionsBarItem>

{
Expand All @@ -211,10 +216,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
messageHandler.send(DashboardMessage.rename, selectedFiles[0]);
setSelectedFiles([]);
}}
title={l10n.t(LocalizationKey.commonRename)}
title={localize(LocalizationKey.commonRename)}
>
<RenameIcon className="w-4 h-4 mr-2" aria-hidden="true" />
<span>{l10n.t(LocalizationKey.commonRename)}</span>
<span>{localize(LocalizationKey.commonRename)}</span>
</ActionsBarItem>
)
}
Expand All @@ -228,10 +233,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
path: selectedFiles[0],
action: 'edit'
})}
title={l10n.t(LocalizationKey.commonEdit)}
title={localize(LocalizationKey.commonEdit)}
>
<PencilIcon className="w-4 h-4 mr-2" aria-hidden="true" />
<span>{l10n.t(LocalizationKey.commonEdit)}</span>
<span>{localize(LocalizationKey.commonEdit)}</span>
</ActionsBarItem>
</>
)
Expand All @@ -245,10 +250,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
className='hover:text-[var(--vscode-statusBarItem-errorBackground)]'
disabled={selectedFiles.length === 0}
onClick={() => setShowAlert(true)}
title={l10n.t(LocalizationKey.commonDelete)}
title={localize(LocalizationKey.commonDelete)}
>
<TrashIcon className="w-4 h-4 mr-2" aria-hidden="true" />
<span>{l10n.t(LocalizationKey.commonDelete)}</span>
<span>{localize(LocalizationKey.commonDelete)}</span>
</ActionsBarItem>
</div>

Expand All @@ -258,33 +263,33 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
<ActionsBarItem
className='flex items-center hover:text-[var(--vscode-statusBarItem-warningBackground)]'
onClick={() => setSelectedFiles([])}
title={l10n.t(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}
title={localize(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}
>
<XMarkIcon className="w-4 h-4 mr-1" aria-hidden="true" />
<span>{l10n.t(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}</span>
<span>{localize(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}</span>
</ActionsBarItem>
)
}

<ActionsBarItem
disabled={selectedFiles.length === pagedItems.length}
disabled={hasAllItemsSelectedOnPage}
onClick={selectAllItems}
title={l10n.t(LocalizationKey.dashboardHeaderActionsBarSelectAll)}
title={localize(LocalizationKey.dashboardHeaderActionsBarSelectAll)}
>
<div className='w-4 h-4 inline-flex items-center justify-center border border-[var(--vscode-sideBar-foreground)] group-hover:border-[var(--vscode-statusBarItem-warningBackground)] rounded mr-1'>
<CheckIcon className="w-3 h-3" aria-hidden="true" />
</div>
<span>{l10n.t(LocalizationKey.dashboardHeaderActionsBarSelectAll)}</span>
<span>{localize(LocalizationKey.dashboardHeaderActionsBarSelectAll)}</span>
</ActionsBarItem>
</div>
</div >

{showAlert && (
<Alert
title={`${l10n.t(LocalizationKey.dashboardHeaderActionsBarAlertDeleteTitle)}`}
description={l10n.t(LocalizationKey.dashboardHeaderActionsBarAlertDeleteDescription)}
okBtnText={l10n.t(LocalizationKey.commonDelete)}
cancelBtnText={l10n.t(LocalizationKey.commonCancel)}
title={`${localize(LocalizationKey.dashboardHeaderActionsBarAlertDeleteTitle)}`}
description={localize(LocalizationKey.dashboardHeaderActionsBarAlertDeleteDescription)}
okBtnText={localize(LocalizationKey.commonDelete)}
cancelBtnText={localize(LocalizationKey.commonCancel)}
dismiss={() => setShowAlert(false)}
trigger={onDeleteConfirm}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/dashboardWebView/components/Header/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { LanguageFilter } from '../Filters/LanguageFilter';

export interface IFiltersProps { }

export const Filters: React.FunctionComponent<IFiltersProps> = (_: React.PropsWithChildren<IFiltersProps>) => {
export const Filters: React.FunctionComponent<IFiltersProps> = () => {
const [crntFilters, setCrntFilters] = useRecoilState(FiltersAtom);
const [crntTag, setCrntTag] = useRecoilState(TagAtom);
const [crntCategory, setCrntCategory] = useRecoilState(CategoryAtom);
Expand Down
2 changes: 1 addition & 1 deletion src/dashboardWebView/components/SnippetsView/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const Item: React.FunctionComponent<IItemProps> = ({

<div className='inline-block mr-1 mt-1 text-xs text-[var(--vscode-button-secondaryForeground)] bg-[var(--vscode-button-secondaryBackground)] border border-[var(--frontmatter-border)] rounded px-1 py-0.5'>
{
snippet.isMediaSnippet ? l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeContent) : l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeMedia)
snippet.isMediaSnippet ? l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeMedia) : l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeContent)
}
</div>

Expand Down
Loading

0 comments on commit f1f0e0a

Please sign in to comment.