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 167167 "command" : " vscode-cnb.rename-post" ,
168168 "title" : " 重命名博文" ,
169169 "category" : " Cnblogs Posts List"
170+ },
171+ {
172+ "command" : " vscode-cnb.open-post-in-blog-admin" ,
173+ "title" : " 在博客后台中打开" ,
174+ "category" : " Cnblogs"
170175 }
171176 ],
172177 "configuration" : {
322327 {
323328 "command" : " vscode-cnb.rename-post" ,
324329 "when" : " false"
330+ },
331+ {
332+ "command" : " vscode-cnb.open-post-in-blog-admin" ,
333+ "when" : " false"
325334 }
326335 ],
327336 "view/item/context" : [
408417 "when" : " resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file" ,
409418 "group" : " cnblogs@1"
410419 },
420+ {
421+ "command" : " vscode-cnb.open-post-in-blog-admin" ,
422+ "when" : " resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file" ,
423+ "group" : " cnblogs@2"
424+ },
411425 {
412426 "command" : " vscode-cnb.upload-clipboard-image" ,
413427 "when" : " resourceLangId == markdown" ,
414- "group" : " cnblogs@2 "
428+ "group" : " cnblogs@3 "
415429 },
416430 {
417431 "command" : " vscode-cnb.upload-local-disk-image" ,
418432 "when" : " resourceLangId == markdown" ,
419- "group" : " cnblogs@3 "
433+ "group" : " cnblogs@4 "
420434 }
421435 ],
422436 "editor/title" : [
439453 {
440454 "command" : " vscode-cnb.show-post-to-local-file-info" ,
441455 "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"
442460 }
443461 ]
444462 },
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import { updatePostCategory } from './post-category/update-post-category';
2828import { openPostInVscode } from './posts-list/open-post-in-vscode' ;
2929import { deletePostToLocalFileMap } from './posts-list/delete-post-to-local-file-map' ;
3030import { renamePost } from './posts-list/rename-post' ;
31+ import { openPostInBlogAdmin } from './open-post-in-blog-admin' ;
3132
3233export const registerCommands = ( ) => {
3334 const context = globalState . extensionContext ;
@@ -65,6 +66,7 @@ export const registerCommands = () => {
6566 vscode . commands . registerCommand ( `${ appName } .update-post-category` , updatePostCategory ) ,
6667 vscode . commands . registerCommand ( `${ appName } .delete-post-to-local-file-map` , deletePostToLocalFileMap ) ,
6768 vscode . commands . registerCommand ( `${ appName } .rename-post` , renamePost ) ,
69+ vscode . commands . registerCommand ( `${ appName } .open-post-in-blog-admin` , openPostInBlogAdmin ) ,
6870 ] ;
6971 context ?. subscriptions . push ( ...disposables ) ;
7072} ;
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