Skip to content

Commit c615624

Browse files
committed
feat: allow save local markdown in any directory to cnblogs
1 parent ce65ef4 commit c615624

File tree

1 file changed

+57
-24
lines changed

1 file changed

+57
-24
lines changed

package.json

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,56 +28,66 @@
2828
"onView:cnblogs-account",
2929
"onView:cnblogs-posts-list",
3030
"onView:vscode-cnb-workspace",
31-
"onCommand:vscode-cnb.open-workspace"
31+
"onCommand:vscode-cnb.open-workspace",
32+
"onCommand:vscode-cnb.login",
33+
"onCommand:vscode-cnb.logout"
3234
],
3335
"main": "./dist/extension.js",
3436
"contributes": {
3537
"commands": [
38+
{
39+
"title": "登录到博客园",
40+
"enablement": "!vscode-cnb.isAuthorized",
41+
"command": "vscode-cnb.login"
42+
},
3643
{
3744
"command": "vscode-cnb.logout",
3845
"title": "登出",
3946
"icon": "dist/assets/icon-logout.svg",
40-
"category": "Cnblogs Account"
47+
"category": "Cnblogs Account",
48+
"enablement": "vscode-cnb.isAuthorized"
4149
},
4250
{
4351
"command": "vscode-cnb.previous-posts-list",
4452
"title": "上一页",
4553
"icon": "dist/assets/icon-page-previous.svg",
46-
"enablement": "!vscode-cnb.posts-list.refreshing && vscode-cnb.posts-list.hasPrevious",
54+
"enablement": "vscode-cnb.isAuthorized && !vscode-cnb.posts-list.refreshing && vscode-cnb.posts-list.hasPrevious",
4755
"category": "Cnblogs Posts List"
4856
},
4957
{
5058
"command": "vscode-cnb.seek-posts-list",
5159
"title": "跳页",
5260
"icon": "dist/assets/icon-seek.svg",
53-
"enablement": "!vscode-cnb.posts-list.refreshing && vscode-cnb.posts-list.pageCount > 0",
61+
"enablement": "vscode-cnb.isAuthorized && !vscode-cnb.posts-list.refreshing && vscode-cnb.posts-list.pageCount > 0",
5462
"category": "Cnblogs Posts List"
5563
},
5664
{
5765
"command": "vscode-cnb.next-posts-list",
5866
"title": "下一页",
5967
"icon": "dist/assets/icon-page-next.svg",
60-
"enablement": "!vscode-cnb.posts-list.refreshing && vscode-cnb.posts-list.hasNext",
68+
"enablement": "vscode-cnb.isAuthorized && !vscode-cnb.posts-list.refreshing && vscode-cnb.posts-list.hasNext",
6169
"category": "Cnblogs Posts List"
6270
},
6371
{
6472
"command": "vscode-cnb.refresh-posts-list",
6573
"title": "刷新",
6674
"icon": "dist/assets/icon-refresh.svg",
67-
"enablement": "!vscode-cnb.posts-list.refreshing",
75+
"enablement": "vscode-cnb.isAuthorized && !vscode-cnb.posts-list.refreshing",
6876
"category": "Cnblogs Posts List"
6977
},
7078
{
7179
"command": "vscode-cnb.save-post",
7280
"title": "保存博文",
7381
"icon": "dist/assets/icon-upload.svg",
74-
"category": "Cnblogs Posts List"
82+
"category": "Cnblogs Posts List",
83+
"enablement": "vscode-cnb.isAuthorized"
7584
},
7685
{
7786
"command": "vscode-cnb.delete-post",
7887
"title": "删除随笔(支持多选)",
7988
"icon": "$(trash)",
80-
"category": "Cnblogs Posts List"
89+
"category": "Cnblogs Posts List",
90+
"enablement": "vscode-cnb.isAuthorized"
8191
},
8292
{
8393
"command": "vscode-cnb.delete-local-draft",
@@ -95,29 +105,34 @@
95105
"command": "vscode-cnb.save-local-draft-to-cnblogs",
96106
"title": "发布",
97107
"icon": "dist/assets/icon-upload.svg",
98-
"category": "Cnblogs Local Draft"
108+
"category": "Cnblogs Local Draft",
109+
"enablement": "vscode-cnb.isAuthorized"
99110
},
100111
{
101112
"command": "vscode-cnb.modify-post-settings",
102113
"title": "修改博文设置",
103114
"icon": "$(gear)",
104-
"category": "Cnblogs Posts List"
115+
"category": "Cnblogs Posts List",
116+
"enablement": "vscode-cnb.isAuthorized"
105117
},
106118
{
107119
"command": "vscode-cnb.upload-image",
108120
"title": "上传图片到博客园",
109121
"category": "Cnblogs",
110-
"icon": "dist/assets/icon-image-upload.svg"
122+
"icon": "dist/assets/icon-image-upload.svg",
123+
"enablement": "vscode-cnb.isAuthorized"
111124
},
112125
{
113126
"command": "vscode-cnb.upload-clipboard-image",
114127
"title": "上传剪贴板图片到博客园",
115-
"category": "Cnblogs"
128+
"category": "Cnblogs",
129+
"enablement": "vscode-cnb.isAuthorized"
116130
},
117131
{
118132
"command": "vscode-cnb.upload-local-disk-image",
119133
"title": "上传本地图片到博客园",
120-
"category": "Cnblogs"
134+
"category": "Cnblogs",
135+
"enablement": "vscode-cnb.isAuthorized"
121136
},
122137
{
123138
"command": "vscode-cnb.reveal-local-post-file-in-os",
@@ -127,24 +142,27 @@
127142
{
128143
"command": "vscode-cnb.save-post-file-to-cnblogs",
129144
"title": "保存到博客园",
130-
"icon": "dist/assets/icon-upload.svg"
145+
"icon": "dist/assets/icon-upload.svg",
146+
"enablement": "vscode-cnb.isAuthorized"
131147
},
132148
{
133149
"command": "vscode-cnb.show-post-to-local-file-info",
134-
"title": "博客园关联博文"
150+
"title": "博客园关联博文",
151+
"enablement": "vscode-cnb.isAuthorized"
135152
},
136153
{
137154
"command": "vscode-cnb.new-post-category",
138155
"title": "新建博文分类",
139156
"icon": "$(add)",
140-
"category": "Cnblogs Post Categories Management"
157+
"category": "Cnblogs Post Categories Management",
158+
"enablement": "vscode-cnb.isAuthorized"
141159
},
142160
{
143161
"command": "vscode-cnb.delete-selected-post-categories",
144162
"title": "删除",
145163
"icon": "$(trash)",
146164
"category": "Cnblogs Post Categories Management",
147-
"enablement": "!vscode-cnb.postCategoriesList.isRefreshing"
165+
"enablement": "vscode-cnb.isAuthorized && !vscode-cnb.postCategoriesList.isRefreshing"
148166
},
149167
{
150168
"command": "vscode-cnb.refresh-post-categories-list",
@@ -168,12 +186,14 @@
168186
{
169187
"command": "vscode-cnb.rename-post",
170188
"title": "重命名博文",
171-
"category": "Cnblogs Posts List"
189+
"category": "Cnblogs Posts List",
190+
"enablement": "vscode-cnb.isAuthorized"
172191
},
173192
{
174193
"command": "vscode-cnb.open-post-in-blog-admin",
175194
"title": "在博客后台中编辑",
176-
"category": "Cnblogs"
195+
"category": "Cnblogs",
196+
"enablement": "vscode-cnb.isAuthorized"
177197
},
178198
{
179199
"command": "vscode-cnb.open-workspace",
@@ -343,6 +363,10 @@
343363
{
344364
"command": "vscode-cnb.open-post-in-blog-admin",
345365
"when": "false"
366+
},
367+
{
368+
"command": "vscode-cnb.login",
369+
"when": "false"
346370
}
347371
],
348372
"view/item/context": [
@@ -424,14 +448,19 @@
424448
}
425449
],
426450
"editor/context": [
451+
{
452+
"command": "vscode-cnb.login",
453+
"when": "!vscode-cnb.isAuthorized",
454+
"group": "cnblogs@0"
455+
},
427456
{
428457
"command": "vscode-cnb.save-post-file-to-cnblogs",
429-
"when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file",
458+
"when": "resourceLangId == markdown",
430459
"group": "cnblogs@1"
431460
},
432461
{
433462
"command": "vscode-cnb.open-post-in-blog-admin",
434-
"when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file",
463+
"when": "resourceLangId == markdown",
435464
"group": "cnblogs@2"
436465
},
437466
{
@@ -458,17 +487,21 @@
458487
}
459488
],
460489
"explorer/context": [
490+
{
491+
"command": "vscode-cnb.login",
492+
"when": "!vscode-cnb.isAuthorized"
493+
},
461494
{
462495
"command": "vscode-cnb.save-post-file-to-cnblogs",
463-
"when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file"
496+
"when": "resourceLangId == markdown"
464497
},
465498
{
466499
"command": "vscode-cnb.show-post-to-local-file-info",
467-
"when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file"
500+
"when": "resourceLangId == markdown"
468501
},
469502
{
470503
"command": "vscode-cnb.open-post-in-blog-admin",
471-
"when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file"
504+
"when": "resourceLangId == markdown"
472505
}
473506
]
474507
},

0 commit comments

Comments
 (0)