Skip to content

Commit f1f0e0a

Browse files
authored
Merge pull request #886 from estruyf/beta
PR for v10.6.0
2 parents 6c591a9 + 5f7f847 commit f1f0e0a

File tree

20 files changed

+237
-147
lines changed

20 files changed

+237
-147
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Change Log
22

3+
## [10.6.0] - 2024-11-06 - [Release notes](https://beta.frontmatter.codes/updates/v10.6.0)
4+
5+
### 🎨 Enhancements
6+
7+
- [#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
8+
- [#882](https://github.com/estruyf/vscode-front-matter/issues/882): Dynamic evaluation of the `node` executable path
9+
- [#884](https://github.com/estruyf/vscode-front-matter/issues/884): Hide WYSIWYG actions when the file is in git diff mode
10+
11+
### 🐞 Fixes
12+
13+
- [#859](https://github.com/estruyf/vscode-front-matter/issues/859): Fix label in the data view dropdown field
14+
- [#876](https://github.com/estruyf/vscode-front-matter/issues/876): Fix snippet type on the snippet card
15+
- [#879](https://github.com/estruyf/vscode-front-matter/issues/879): Fix for auto updating last modified date on save
16+
- [#885](https://github.com/estruyf/vscode-front-matter/issues/885): Fix content relationship for none i18n content
17+
318
## [10.5.1] - 2024-10-23
419

520
### 🎨 Enhancements

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Front Matter CMS",
44
"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...",
55
"icon": "assets/frontmatter-teal-128x128.png",
6-
"version": "10.5.1",
6+
"version": "10.6.0",
77
"preview": false,
88
"publisher": "eliostruyf",
99
"galleryBanner": {
@@ -31,7 +31,7 @@
3131
"l10n": "./l10n",
3232
"categories": [
3333
"AI",
34-
"Other"
34+
"Visualization"
3535
],
3636
"keywords": [
3737
"Front Matter",
@@ -2421,32 +2421,32 @@
24212421
"editor/title": [{
24222422
"command": "frontMatter.markup.heading",
24232423
"group": "navigation@-133",
2424-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2424+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24252425
},
24262426
{
24272427
"command": "frontMatter.markup.bold",
24282428
"group": "navigation@-132",
2429-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2429+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24302430
},
24312431
{
24322432
"command": "frontMatter.markup.italic",
24332433
"group": "navigation@-131",
2434-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2434+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24352435
},
24362436
{
24372437
"command": "frontMatter.markup.hyperlink",
24382438
"group": "navigation@-130",
2439-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2439+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24402440
},
24412441
{
24422442
"command": "frontMatter.insertSnippet",
24432443
"group": "navigation@-129",
2444-
"when": "frontMatter:file:isValid == true && frontMatter:dashboard:snippets:enabled"
2444+
"when": "frontMatter:file:isValid == true && frontMatter:dashboard:snippets:enabled && activeEditor == 'workbench.editors.files.textFileEditor'"
24452445
},
24462446
{
24472447
"command": "frontMatter.insertMedia",
24482448
"group": "navigation@-128",
2449-
"when": "frontMatter:file:isValid == true"
2449+
"when": "frontMatter:file:isValid == true && activeEditor == 'workbench.editors.files.textFileEditor'"
24502450
},
24512451
{
24522452
"command": "frontMatter.i18n.createOrOpen",
@@ -2456,37 +2456,37 @@
24562456
{
24572457
"command": "frontMatter.markup.options",
24582458
"group": "navigation@-126",
2459-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2459+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24602460
},
24612461
{
24622462
"command": "frontMatter.markup.orderedlist",
24632463
"group": "1_markup@1",
2464-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2464+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24652465
},
24662466
{
24672467
"command": "frontMatter.markup.unorderedlist",
24682468
"group": "1_markup@2",
2469-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2469+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24702470
},
24712471
{
24722472
"command": "frontMatter.markup.tasklist",
24732473
"group": "1_markup@3",
2474-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2474+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24752475
},
24762476
{
24772477
"command": "frontMatter.markup.code",
24782478
"group": "1_markup@4",
2479-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2479+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24802480
},
24812481
{
24822482
"command": "frontMatter.markup.codeblock",
24832483
"group": "1_markup@5",
2484-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2484+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24852485
},
24862486
{
24872487
"command": "frontMatter.markup.blockquote",
24882488
"group": "1_markup@6",
2489-
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
2489+
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg && activeEditor == 'workbench.editors.files.textFileEditor'"
24902490
},
24912491
{
24922492
"command": "frontMatter.dashboard",

src/commands/Article.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class Article {
5252
*
5353
* @param subscriptions - The array of subscriptions to register the commands with.
5454
*/
55-
public static async registerCommands(subscriptions: unknown[]) {
55+
public static registerCommands(subscriptions: unknown[]) {
5656
subscriptions.push(
5757
commands.registerCommand(COMMAND_NAME.setLastModifiedDate, Article.setLastModifiedDate)
5858
);
@@ -66,6 +66,15 @@ export class Article {
6666
subscriptions.push(commands.registerCommand(COMMAND_NAME.insertSnippet, Article.insertSnippet));
6767
}
6868

69+
/**
70+
* Registers event listeners for the Article class.
71+
*
72+
* @param subscriptions - An array to which the event listener will be added.
73+
*/
74+
public static registerListeners(subscriptions: unknown[]) {
75+
subscriptions.push(workspace.onWillSaveTextDocument(Article.autoUpdate));
76+
}
77+
6978
/**
7079
* Sets the article date
7180
*/
@@ -369,15 +378,15 @@ export class Article {
369378
* Article auto updater
370379
* @param event
371380
*/
372-
public static async autoUpdate(event: TextDocumentWillSaveEvent) {
381+
public static autoUpdate(event: TextDocumentWillSaveEvent) {
373382
const document = event.document;
374383
if (document && ArticleHelper.isSupportedFile(document)) {
375384
const autoUpdate = Settings.get(SETTING_AUTO_UPDATE_DATE);
376385

377386
// Is article located in one of the content folders
378-
const folders = await Folders.getCachedOrFresh();
387+
const folders = Folders.getCached();
379388
const documentPath = parseWinPath(document.fileName);
380-
const folder = folders.find((f) => documentPath.startsWith(f.path));
389+
const folder = folders?.find((f) => documentPath.startsWith(f.path));
381390
if (!folder) {
382391
return;
383392
}

src/components/uniforms-frontmatter/SelectField.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ function Select({
4242
...props
4343
}: SelectFieldProps) {
4444
const multiple = fieldType === Array;
45+
4546
return (
4647
<div className="autoform__select_field" {...filterDOMProps(props)}>
4748
<LabelField label={label} id={id} required={required} />
@@ -84,11 +85,12 @@ function Select({
8485
}}
8586
ref={inputRef}
8687
value={value ?? ''}
88+
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'
8789
style={{ width: '100%', padding: '0.5rem' }}
8890
>
89-
{(!!placeholder || !required || value === undefined) && !multiple && (
91+
{(!required || value === undefined) && !multiple && (
9092
<option value="" disabled={required} hidden={required}>
91-
{placeholder || label}
93+
{""}
9294
</option>
9395
)}
9496

src/dashboardWebView/components/Common/ItemSelection.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export const ItemSelection: React.FunctionComponent<IItemSelectionProps> = ({
2525
<div className={`${cssNames} group-hover:block`}>
2626
<VSCodeCheckbox
2727
className={show ? "" : " shadow-[0_0_3px_var(--frontmatter-border-preserve)]"}
28+
onClick={(e) => {
29+
e.stopPropagation();
30+
}}
2831
onChange={() => {
2932
onMultiSelect(filePath);
3033
}}

src/dashboardWebView/components/Header/ActionsBar.tsx

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { CommandLineIcon, PencilIcon, TrashIcon, ChevronDownIcon, XMarkIcon, Eye
44
import { useRecoilState, useRecoilValue } from 'recoil';
55
import { MultiSelectedItemsAtom, PagedItems, SelectedItemActionAtom, SelectedMediaFolderSelector, SettingsSelector } from '../../state';
66
import { ActionsBarItem } from './ActionsBarItem';
7-
import * as l10n from '@vscode/l10n';
8-
import { LocalizationKey } from '../../../localization';
7+
import { LocalizationKey, localize } from '../../../localization';
98
import { Alert } from '../Modals/Alert';
109
import { messageHandler } from '@estruyf/vscode/dist/client';
1110
import { DashboardMessage } from '../../DashboardMessage';
@@ -68,8 +67,14 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
6867
}, [selectedFiles]);
6968

7069
const selectAllItems = React.useCallback(() => {
71-
setSelectedFiles([...pagedItems]);
72-
}, [pagedItems]);
70+
const allSelected = [...selectedFiles, ...pagedItems];
71+
setSelectedFiles(Array.from(new Set(allSelected)));
72+
}, [selectedFiles, pagedItems]);
73+
74+
const hasAllItemsSelectedOnPage = React.useMemo(() => {
75+
const selectedItemsOnPage = selectedFiles.filter((file) => pagedItems.includes(file));
76+
return selectedItemsOnPage.length >= pagedItems.length;
77+
}, [selectedFiles, pagedItems]);
7378

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

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

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

@@ -197,10 +202,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
197202
<ActionsBarItem
198203
disabled={selectedFiles.length === 0 || selectedFiles.length > 1}
199204
onClick={viewFile}
200-
title={l10n.t(LocalizationKey.commonView)}
205+
title={localize(LocalizationKey.commonView)}
201206
>
202207
<EyeIcon className="w-4 h-4 mr-2" aria-hidden="true" />
203-
<span>{l10n.t(LocalizationKey.commonView)}</span>
208+
<span>{localize(LocalizationKey.commonView)}</span>
204209
</ActionsBarItem>
205210

206211
{
@@ -211,10 +216,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
211216
messageHandler.send(DashboardMessage.rename, selectedFiles[0]);
212217
setSelectedFiles([]);
213218
}}
214-
title={l10n.t(LocalizationKey.commonRename)}
219+
title={localize(LocalizationKey.commonRename)}
215220
>
216221
<RenameIcon className="w-4 h-4 mr-2" aria-hidden="true" />
217-
<span>{l10n.t(LocalizationKey.commonRename)}</span>
222+
<span>{localize(LocalizationKey.commonRename)}</span>
218223
</ActionsBarItem>
219224
)
220225
}
@@ -228,10 +233,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
228233
path: selectedFiles[0],
229234
action: 'edit'
230235
})}
231-
title={l10n.t(LocalizationKey.commonEdit)}
236+
title={localize(LocalizationKey.commonEdit)}
232237
>
233238
<PencilIcon className="w-4 h-4 mr-2" aria-hidden="true" />
234-
<span>{l10n.t(LocalizationKey.commonEdit)}</span>
239+
<span>{localize(LocalizationKey.commonEdit)}</span>
235240
</ActionsBarItem>
236241
</>
237242
)
@@ -245,10 +250,10 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
245250
className='hover:text-[var(--vscode-statusBarItem-errorBackground)]'
246251
disabled={selectedFiles.length === 0}
247252
onClick={() => setShowAlert(true)}
248-
title={l10n.t(LocalizationKey.commonDelete)}
253+
title={localize(LocalizationKey.commonDelete)}
249254
>
250255
<TrashIcon className="w-4 h-4 mr-2" aria-hidden="true" />
251-
<span>{l10n.t(LocalizationKey.commonDelete)}</span>
256+
<span>{localize(LocalizationKey.commonDelete)}</span>
252257
</ActionsBarItem>
253258
</div>
254259

@@ -258,33 +263,33 @@ export const ActionsBar: React.FunctionComponent<IActionsBarProps> = ({
258263
<ActionsBarItem
259264
className='flex items-center hover:text-[var(--vscode-statusBarItem-warningBackground)]'
260265
onClick={() => setSelectedFiles([])}
261-
title={l10n.t(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}
266+
title={localize(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}
262267
>
263268
<XMarkIcon className="w-4 h-4 mr-1" aria-hidden="true" />
264-
<span>{l10n.t(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}</span>
269+
<span>{localize(LocalizationKey.dashboardHeaderActionsBarItemsSelected, selectedFiles.length)}</span>
265270
</ActionsBarItem>
266271
)
267272
}
268273

269274
<ActionsBarItem
270-
disabled={selectedFiles.length === pagedItems.length}
275+
disabled={hasAllItemsSelectedOnPage}
271276
onClick={selectAllItems}
272-
title={l10n.t(LocalizationKey.dashboardHeaderActionsBarSelectAll)}
277+
title={localize(LocalizationKey.dashboardHeaderActionsBarSelectAll)}
273278
>
274279
<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'>
275280
<CheckIcon className="w-3 h-3" aria-hidden="true" />
276281
</div>
277-
<span>{l10n.t(LocalizationKey.dashboardHeaderActionsBarSelectAll)}</span>
282+
<span>{localize(LocalizationKey.dashboardHeaderActionsBarSelectAll)}</span>
278283
</ActionsBarItem>
279284
</div>
280285
</div >
281286

282287
{showAlert && (
283288
<Alert
284-
title={`${l10n.t(LocalizationKey.dashboardHeaderActionsBarAlertDeleteTitle)}`}
285-
description={l10n.t(LocalizationKey.dashboardHeaderActionsBarAlertDeleteDescription)}
286-
okBtnText={l10n.t(LocalizationKey.commonDelete)}
287-
cancelBtnText={l10n.t(LocalizationKey.commonCancel)}
289+
title={`${localize(LocalizationKey.dashboardHeaderActionsBarAlertDeleteTitle)}`}
290+
description={localize(LocalizationKey.dashboardHeaderActionsBarAlertDeleteDescription)}
291+
okBtnText={localize(LocalizationKey.commonDelete)}
292+
cancelBtnText={localize(LocalizationKey.commonCancel)}
288293
dismiss={() => setShowAlert(false)}
289294
trigger={onDeleteConfirm}
290295
/>

src/dashboardWebView/components/Header/Filters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { LanguageFilter } from '../Filters/LanguageFilter';
1010

1111
export interface IFiltersProps { }
1212

13-
export const Filters: React.FunctionComponent<IFiltersProps> = (_: React.PropsWithChildren<IFiltersProps>) => {
13+
export const Filters: React.FunctionComponent<IFiltersProps> = () => {
1414
const [crntFilters, setCrntFilters] = useRecoilState(FiltersAtom);
1515
const [crntTag, setCrntTag] = useRecoilState(TagAtom);
1616
const [crntCategory, setCrntCategory] = useRecoilState(CategoryAtom);

src/dashboardWebView/components/SnippetsView/Item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export const Item: React.FunctionComponent<IItemProps> = ({
183183

184184
<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'>
185185
{
186-
snippet.isMediaSnippet ? l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeContent) : l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeMedia)
186+
snippet.isMediaSnippet ? l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeMedia) : l10n.t(LocalizationKey.dashboardSnippetsViewItemTypeContent)
187187
}
188188
</div>
189189

0 commit comments

Comments
 (0)