File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change 167
167
"command" : " vscode-cnb.rename-post" ,
168
168
"title" : " 重命名博文" ,
169
169
"category" : " Cnblogs Posts List"
170
+ },
171
+ {
172
+ "command" : " vscode-cnb.open-post-in-blog-admin" ,
173
+ "title" : " 在博客后台中打开" ,
174
+ "category" : " Cnblogs"
170
175
}
171
176
],
172
177
"configuration" : {
322
327
{
323
328
"command" : " vscode-cnb.rename-post" ,
324
329
"when" : " false"
330
+ },
331
+ {
332
+ "command" : " vscode-cnb.open-post-in-blog-admin" ,
333
+ "when" : " false"
325
334
}
326
335
],
327
336
"view/item/context" : [
408
417
"when" : " resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file" ,
409
418
"group" : " cnblogs@1"
410
419
},
420
+ {
421
+ "command" : " vscode-cnb.open-post-in-blog-admin" ,
422
+ "when" : " resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file" ,
423
+ "group" : " cnblogs@2"
424
+ },
411
425
{
412
426
"command" : " vscode-cnb.upload-clipboard-image" ,
413
427
"when" : " resourceLangId == markdown" ,
414
- "group" : " cnblogs@2 "
428
+ "group" : " cnblogs@3 "
415
429
},
416
430
{
417
431
"command" : " vscode-cnb.upload-local-disk-image" ,
418
432
"when" : " resourceLangId == markdown" ,
419
- "group" : " cnblogs@3 "
433
+ "group" : " cnblogs@4 "
420
434
}
421
435
],
422
436
"editor/title" : [
439
453
{
440
454
"command" : " vscode-cnb.show-post-to-local-file-info" ,
441
455
"when" : " resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file"
456
+ },
457
+ {
458
+ "command" : " vscode-cnb.open-post-in-blog-admin" ,
459
+ "when" : " resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file"
442
460
}
443
461
]
444
462
},
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import { updatePostCategory } from './post-category/update-post-category';
28
28
import { openPostInVscode } from './posts-list/open-post-in-vscode' ;
29
29
import { deletePostToLocalFileMap } from './posts-list/delete-post-to-local-file-map' ;
30
30
import { renamePost } from './posts-list/rename-post' ;
31
+ import { openPostInBlogAdmin } from './open-post-in-blog-admin' ;
31
32
32
33
export const registerCommands = ( ) => {
33
34
const context = globalState . extensionContext ;
@@ -65,6 +66,7 @@ export const registerCommands = () => {
65
66
vscode . commands . registerCommand ( `${ appName } .update-post-category` , updatePostCategory ) ,
66
67
vscode . commands . registerCommand ( `${ appName } .delete-post-to-local-file-map` , deletePostToLocalFileMap ) ,
67
68
vscode . commands . registerCommand ( `${ appName } .rename-post` , renamePost ) ,
69
+ vscode . commands . registerCommand ( `${ appName } .open-post-in-blog-admin` , openPostInBlogAdmin ) ,
68
70
] ;
69
71
context ?. subscriptions . push ( ...disposables ) ;
70
72
} ;
Original file line number Diff line number Diff line change
1
+ import { commands , Uri } from 'vscode' ;
2
+ import { BlogPost } from '../models/blog-post' ;
3
+
4
+ export const openPostInBlogAdmin = ( item : BlogPost | Uri ) => {
5
+ if ( ! item ) {
6
+ return ;
7
+ }
8
+
9
+ const postId = item instanceof BlogPost ? item . id : - 1 ;
10
+
11
+ commands . executeCommand ( 'vscode.open' , Uri . parse ( `https://i.cnblogs.com/posts/edit;postId=${ postId } ` ) ) ;
12
+ } ;
You can’t perform that action at this time.
0 commit comments