Skip to content

Commit

Permalink
Updates for v1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Feb 26, 2021
1 parent b6f8fa2 commit 4d7ecce
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [1.13.0] - 2020-02-26

- Implemented links to quickly open the extension settings + issue from the FrontMatter view panel
- Added button to update the modified time in the FrontMatter view panel

## [1.12.1] - 2020-02-13

- Fix Front Matter SVG
Expand Down
16 changes: 16 additions & 0 deletions assets/media/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,20 @@
border-right: 1px solid var(--vscode-inputValidation-infoBorder);

filter: contrast(60%);
}

.ext_link_block {
margin-bottom: .5rem;
text-align: right;
}

.ext_link_block a {
color: var(--vscode-textLink-foreground);
}

.ext_link_block a:hover,
.ext_link_block a:active,
.ext_link_block a:focus,
.ext_link_block a:visited {
color: var(--vscode-textLink-activeForeground);
}
4 changes: 3 additions & 1 deletion src/viewpanel/CommandToCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ export enum CommandToCode {
getData = "get-data",
updateSlug = 'update-slug',
updateDate = 'update-date',
updateLastMod = 'update-lastmod',
publish = 'publish',
updateTags = "update-tags",
updateCategories = "update-categories",
addTagToSettings = "add-tag",
addCategoryToSettings = "add-category"
addCategoryToSettings = "add-category",
openSettings = "open-settings"
}
14 changes: 14 additions & 0 deletions src/viewpanel/ViewPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as React from 'react';
import { CommandToCode } from './CommandToCode';
import { Actions } from './components/Actions';
import { SeoStatus } from './components/SeoStatus';
import { Spinner } from './components/Spinner';
import { TagPicker } from './components/TagPicker';
import { MessageHelper } from './helper/MessageHelper';
import useMessages from './hooks/useMessages';
import { TagType } from './TagType';

Expand All @@ -26,6 +28,10 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (props: React
);
}

const openSettings = () => {
MessageHelper.sendMessage(CommandToCode.openSettings);
};

return (
<div className="frontmatter">
{
Expand Down Expand Up @@ -54,6 +60,14 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (props: React
unsetFocus={unsetFocus} />
)
}

<div className="ext_link_block">
<a href="javascript:;" onClick={openSettings}>Open settings</a>
</div>

<div className="ext_link_block">
<a href="https://github.com/estruyf/vscode-front-matter/issues" title="Open an issue on GitHub">Report an issue</a>
</div>
</div>
);
};
17 changes: 12 additions & 5 deletions src/viewpanel/components/DateAction.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


import * as React from 'react';
import { CommandToCode } from '../CommandToCode';
import { MessageHelper } from '../helper/MessageHelper';
Expand All @@ -11,10 +9,19 @@ export const DateAction: React.FunctionComponent<IDateActionProps> = (props: Rea
const setDate = () => {
MessageHelper.sendMessage(CommandToCode.updateDate);
};

const setLastMod = () => {
MessageHelper.sendMessage(CommandToCode.updateLastMod);
};

return (
<div className={`article__action`}>
<button onClick={setDate}>Set current date</button>
</div>
<>
<div className={`article__action`}>
<button onClick={setDate}>Set publish date</button>
</div>
<div className={`article__action`}>
<button onClick={setLastMod}>Set modified date</button>
</div>
</>
);
};
8 changes: 7 additions & 1 deletion src/webview/ExplorerView.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PanelSettings } from './../models/PanelSettings';
import { CancellationToken, Disposable, Uri, Webview, WebviewView, WebviewViewProvider, WebviewViewResolveContext, window, workspace } from "vscode";
import { CancellationToken, Disposable, Uri, Webview, WebviewView, WebviewViewProvider, WebviewViewResolveContext, window, workspace, commands } from "vscode";
import { CONFIG_KEY, SETTING_PANEL_FREEFORM, SETTING_SEO_DESCRIPTION_LENGTH, SETTING_SEO_TITLE_LENGTH, SETTING_SLUG_PREFIX, SETTING_SLUG_SUFFIX, SETTING_TAXONOMY_CATEGORIES, SETTING_TAXONOMY_TAGS } from "../constants";
import { ArticleHelper, SettingsHelper } from "../helpers";
import { Command } from "../viewpanel/Command";
Expand Down Expand Up @@ -82,6 +82,9 @@ export class ExplorerView implements WebviewViewProvider, Disposable {
case CommandToCode.updateDate:
Article.setDate();
break;
case CommandToCode.updateLastMod:
Article.setLastModifiedDate();
break;
case CommandToCode.publish:
Article.toggleDraft();
break;
Expand All @@ -97,6 +100,9 @@ export class ExplorerView implements WebviewViewProvider, Disposable {
case CommandToCode.addCategoryToSettings:
this.addTags(TagType.categories, msg.data);
break;
case CommandToCode.openSettings:
commands.executeCommand('workbench.action.openSettings', '@ext:eliostruyf.vscode-front-matter');
break;
}
});

Expand Down

0 comments on commit 4d7ecce

Please sign in to comment.