#284 - Set the WYSIWYG on all supported files

This commit is contained in:
Elio Struyf
2022-03-08 15:40:55 +01:00
parent b867f72fe2
commit 438160d08f
4 changed files with 21 additions and 14 deletions
+1
View File
@@ -22,6 +22,7 @@
- [#279](https://github.com/estruyf/vscode-front-matter/issues/279): Fix for content dashboard updates for all registered types
- [#280](https://github.com/estruyf/vscode-front-matter/issues/280): Fix to not automatically set dates on new files that do not contain front matter
- [#284](https://github.com/estruyf/vscode-front-matter/issues/284): Show the WYSIWYG controls on all supported file types
## [6.1.1] - 2022-03-02
+13 -13
View File
@@ -1346,67 +1346,67 @@
{
"command": "frontMatter.markup.heading",
"group": "navigation@-133",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.bold",
"group": "navigation@-132",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.italic",
"group": "navigation@-131",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.strikethrough",
"group": "navigation@-130",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.insertSnippet",
"group": "navigation@-129",
"when": "resourceLangId == markdown"
"when": "frontMatter:file:isValid == true"
},
{
"command": "frontMatter.insertImage",
"group": "navigation@-128",
"when": "resourceLangId == markdown"
"when": "frontMatter:file:isValid == true"
},
{
"command": "frontMatter.markup.options",
"group": "navigation@-126",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.orderedlist",
"group": "1_markup@1",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.unorderedlist",
"group": "1_markup@2",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.tasklist",
"group": "1_markup@3",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.code",
"group": "1_markup@4",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.codeblock",
"group": "1_markup@5",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.markup.blockquote",
"group": "1_markup@6",
"when": "resourceLangId == markdown && frontMatter:markdown:wysiwyg"
"when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg"
},
{
"command": "frontMatter.dashboard",
+6 -1
View File
@@ -1,10 +1,11 @@
import { SETTING_SEO_DESCRIPTION_FIELD, SETTING_SEO_DESCRIPTION_LENGTH, SETTING_SEO_TITLE_LENGTH } from './../constants';
import { CONTEXT, SETTING_SEO_DESCRIPTION_FIELD, SETTING_SEO_DESCRIPTION_LENGTH, SETTING_SEO_TITLE_LENGTH } from './../constants';
import * as vscode from 'vscode';
import { ArticleHelper, SeoHelper, Settings } from '../helpers';
import { ExplorerView } from '../explorerView/ExplorerView';
import { DefaultFields } from '../constants';
import { ContentType } from '../helpers/ContentType';
import { DataListener } from '../listeners/panel';
import { commands } from 'vscode';
export class StatusListener {
@@ -26,6 +27,8 @@ export class StatusListener {
let editor = vscode.window.activeTextEditor;
if (editor && ArticleHelper.isMarkdownFile()) {
try {
commands.executeCommand('setContext', CONTEXT.isValidFile, true);
const article = ArticleHelper.getFrontMatter(editor);
// Update the StatusBar based on the article draft state
@@ -67,6 +70,8 @@ export class StatusListener {
// Nothing to do
}
} else {
commands.executeCommand('setContext', CONTEXT.isValidFile, false);
const panel = ExplorerView.getInstance();
if (panel && panel.visible) {
DataListener.pushMetadata(null);
+1
View File
@@ -7,4 +7,5 @@ export const CONTEXT = {
isDashboardOpen: "frontMatter:dashboard:open",
wysiwyg: "frontMatter:markdown:wysiwyg",
backer: "frontMatter:backers:supporter",
isValidFile: "frontMatter:file:isValid",
};