Skip to content

Commit 8c98be9

Browse files
authored
ui: make view-post-online command visible in vscode command palette (#52)
1 parent 3d17292 commit 8c98be9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@
428428
},
429429
{
430430
"command": "vscode-cnb.view-post-online",
431-
"when": "false"
431+
"when": "true"
432432
},
433433
{
434434
"command": "vscode-cnb.export-post-to-pdf",

src/commands/view-post-online.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import { commands, Uri } from 'vscode';
1+
import { commands, Uri, window } from 'vscode';
22
import { Post } from '../models/post';
33
import { postService } from '../services/post.service';
44
import { PostFileMapManager } from '../services/post-file-map';
55

6-
export const viewPostOnline = async (input: Post | Uri) => {
6+
export const viewPostOnline = async (input?: Post | Uri) => {
77
let post: Post | undefined = input instanceof Post ? input : undefined;
8+
if (!input) {
9+
input = window.activeTextEditor?.document.uri;
10+
}
811
if (input instanceof Uri) {
912
const postId = PostFileMapManager.getPostId(input.fsPath);
1013
if (postId) {

0 commit comments

Comments
 (0)