mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-05-06 21:42:24 +02:00
Fix for mode switch
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
### 🎨 Enhancements
|
||||
|
||||
- [#263](https://github.com/estruyf/vscode-front-matter/issues/263): WYSIWYG string field option
|
||||
- [#308](https://github.com/estruyf/vscode-front-matter/issues/308): New `File` field
|
||||
- [#314](https://github.com/estruyf/vscode-front-matter/issues/314): New preview actions to open the page in the browser and refresh the preview
|
||||
- [#322](https://github.com/estruyf/vscode-front-matter/issues/322): Show parent folder name when file is an index page (`index.md` / `_index.md`)
|
||||
|
||||
@@ -12,6 +13,10 @@
|
||||
|
||||
- [#316](https://github.com/estruyf/vscode-front-matter/issues/316): Surpress file parsing errors when closing the dashboard
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- Hide the view mode action from the Front Matter panel if no custom modes are defined
|
||||
|
||||
## [7.1.2] - 2022-04-11
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
@@ -1692,7 +1692,7 @@
|
||||
{
|
||||
"command": "frontMatter.mode.switch",
|
||||
"group": "navigation@1",
|
||||
"when": "view == frontMatter.explorer"
|
||||
"when": "view == frontMatter.explorer && frontMatter:has:modes == true"
|
||||
},
|
||||
{
|
||||
"command": "frontMatter.dashboard",
|
||||
|
||||
@@ -9,6 +9,8 @@ export const CONTEXT = {
|
||||
backer: "frontMatter:backers:supporter",
|
||||
isValidFile: "frontMatter:file:isValid",
|
||||
|
||||
hasViewModes: "frontMatter:has:modes",
|
||||
|
||||
isSnippetsDashboardEnabled: "frontMatter:dashboard:snippets:enabled",
|
||||
isDataDashboardEnabled: "frontMatter:dashboard:data:enabled",
|
||||
};
|
||||
@@ -2,7 +2,7 @@ import { ModeListener } from './../listeners/general/ModeListener';
|
||||
import { SETTING_GLOBAL_ACTIVE_MODE, SETTING_GLOBAL_MODES } from './../constants/settings';
|
||||
import { commands, StatusBarAlignment, StatusBarItem, ThemeColor, window } from "vscode";
|
||||
import { Settings } from "../helpers/SettingsHelper";
|
||||
import { COMMAND_NAME } from '../constants';
|
||||
import { COMMAND_NAME, CONTEXT } from '../constants';
|
||||
import { Mode } from '../models';
|
||||
|
||||
|
||||
@@ -36,9 +36,11 @@ export class ModeSwitch {
|
||||
const modes = Settings.get<string | null>(SETTING_GLOBAL_MODES);
|
||||
if (!modes || modes.length === 0) {
|
||||
ModeSwitch.statusBarElm.hide();
|
||||
commands.executeCommand('setContext', CONTEXT.hasViewModes, false);
|
||||
return;
|
||||
}
|
||||
|
||||
commands.executeCommand('setContext', CONTEXT.hasViewModes, true);
|
||||
ModeSwitch.setText();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user