|
28 | 28 | "onView:cnblogs-account", |
29 | 29 | "onView:cnblogs-posts-list", |
30 | 30 | "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" |
32 | 34 | ], |
33 | 35 | "main": "./dist/extension.js", |
34 | 36 | "contributes": { |
35 | 37 | "commands": [ |
| 38 | + { |
| 39 | + "title": "登录到博客园", |
| 40 | + "enablement": "!vscode-cnb.isAuthorized", |
| 41 | + "command": "vscode-cnb.login" |
| 42 | + }, |
36 | 43 | { |
37 | 44 | "command": "vscode-cnb.logout", |
38 | 45 | "title": "登出", |
39 | 46 | "icon": "dist/assets/icon-logout.svg", |
40 | | - "category": "Cnblogs Account" |
| 47 | + "category": "Cnblogs Account", |
| 48 | + "enablement": "vscode-cnb.isAuthorized" |
41 | 49 | }, |
42 | 50 | { |
43 | 51 | "command": "vscode-cnb.previous-posts-list", |
44 | 52 | "title": "上一页", |
45 | 53 | "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", |
47 | 55 | "category": "Cnblogs Posts List" |
48 | 56 | }, |
49 | 57 | { |
50 | 58 | "command": "vscode-cnb.seek-posts-list", |
51 | 59 | "title": "跳页", |
52 | 60 | "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", |
54 | 62 | "category": "Cnblogs Posts List" |
55 | 63 | }, |
56 | 64 | { |
57 | 65 | "command": "vscode-cnb.next-posts-list", |
58 | 66 | "title": "下一页", |
59 | 67 | "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", |
61 | 69 | "category": "Cnblogs Posts List" |
62 | 70 | }, |
63 | 71 | { |
64 | 72 | "command": "vscode-cnb.refresh-posts-list", |
65 | 73 | "title": "刷新", |
66 | 74 | "icon": "dist/assets/icon-refresh.svg", |
67 | | - "enablement": "!vscode-cnb.posts-list.refreshing", |
| 75 | + "enablement": "vscode-cnb.isAuthorized && !vscode-cnb.posts-list.refreshing", |
68 | 76 | "category": "Cnblogs Posts List" |
69 | 77 | }, |
70 | 78 | { |
71 | 79 | "command": "vscode-cnb.save-post", |
72 | 80 | "title": "保存博文", |
73 | 81 | "icon": "dist/assets/icon-upload.svg", |
74 | | - "category": "Cnblogs Posts List" |
| 82 | + "category": "Cnblogs Posts List", |
| 83 | + "enablement": "vscode-cnb.isAuthorized" |
75 | 84 | }, |
76 | 85 | { |
77 | 86 | "command": "vscode-cnb.delete-post", |
78 | 87 | "title": "删除随笔(支持多选)", |
79 | 88 | "icon": "$(trash)", |
80 | | - "category": "Cnblogs Posts List" |
| 89 | + "category": "Cnblogs Posts List", |
| 90 | + "enablement": "vscode-cnb.isAuthorized" |
81 | 91 | }, |
82 | 92 | { |
83 | 93 | "command": "vscode-cnb.delete-local-draft", |
|
95 | 105 | "command": "vscode-cnb.save-local-draft-to-cnblogs", |
96 | 106 | "title": "发布", |
97 | 107 | "icon": "dist/assets/icon-upload.svg", |
98 | | - "category": "Cnblogs Local Draft" |
| 108 | + "category": "Cnblogs Local Draft", |
| 109 | + "enablement": "vscode-cnb.isAuthorized" |
99 | 110 | }, |
100 | 111 | { |
101 | 112 | "command": "vscode-cnb.modify-post-settings", |
102 | 113 | "title": "修改博文设置", |
103 | 114 | "icon": "$(gear)", |
104 | | - "category": "Cnblogs Posts List" |
| 115 | + "category": "Cnblogs Posts List", |
| 116 | + "enablement": "vscode-cnb.isAuthorized" |
105 | 117 | }, |
106 | 118 | { |
107 | 119 | "command": "vscode-cnb.upload-image", |
108 | 120 | "title": "上传图片到博客园", |
109 | 121 | "category": "Cnblogs", |
110 | | - "icon": "dist/assets/icon-image-upload.svg" |
| 122 | + "icon": "dist/assets/icon-image-upload.svg", |
| 123 | + "enablement": "vscode-cnb.isAuthorized" |
111 | 124 | }, |
112 | 125 | { |
113 | 126 | "command": "vscode-cnb.upload-clipboard-image", |
114 | 127 | "title": "上传剪贴板图片到博客园", |
115 | | - "category": "Cnblogs" |
| 128 | + "category": "Cnblogs", |
| 129 | + "enablement": "vscode-cnb.isAuthorized" |
116 | 130 | }, |
117 | 131 | { |
118 | 132 | "command": "vscode-cnb.upload-local-disk-image", |
119 | 133 | "title": "上传本地图片到博客园", |
120 | | - "category": "Cnblogs" |
| 134 | + "category": "Cnblogs", |
| 135 | + "enablement": "vscode-cnb.isAuthorized" |
121 | 136 | }, |
122 | 137 | { |
123 | 138 | "command": "vscode-cnb.reveal-local-post-file-in-os", |
|
127 | 142 | { |
128 | 143 | "command": "vscode-cnb.save-post-file-to-cnblogs", |
129 | 144 | "title": "保存到博客园", |
130 | | - "icon": "dist/assets/icon-upload.svg" |
| 145 | + "icon": "dist/assets/icon-upload.svg", |
| 146 | + "enablement": "vscode-cnb.isAuthorized" |
131 | 147 | }, |
132 | 148 | { |
133 | 149 | "command": "vscode-cnb.show-post-to-local-file-info", |
134 | | - "title": "博客园关联博文" |
| 150 | + "title": "博客园关联博文", |
| 151 | + "enablement": "vscode-cnb.isAuthorized" |
135 | 152 | }, |
136 | 153 | { |
137 | 154 | "command": "vscode-cnb.new-post-category", |
138 | 155 | "title": "新建博文分类", |
139 | 156 | "icon": "$(add)", |
140 | | - "category": "Cnblogs Post Categories Management" |
| 157 | + "category": "Cnblogs Post Categories Management", |
| 158 | + "enablement": "vscode-cnb.isAuthorized" |
141 | 159 | }, |
142 | 160 | { |
143 | 161 | "command": "vscode-cnb.delete-selected-post-categories", |
144 | 162 | "title": "删除", |
145 | 163 | "icon": "$(trash)", |
146 | 164 | "category": "Cnblogs Post Categories Management", |
147 | | - "enablement": "!vscode-cnb.postCategoriesList.isRefreshing" |
| 165 | + "enablement": "vscode-cnb.isAuthorized && !vscode-cnb.postCategoriesList.isRefreshing" |
148 | 166 | }, |
149 | 167 | { |
150 | 168 | "command": "vscode-cnb.refresh-post-categories-list", |
|
168 | 186 | { |
169 | 187 | "command": "vscode-cnb.rename-post", |
170 | 188 | "title": "重命名博文", |
171 | | - "category": "Cnblogs Posts List" |
| 189 | + "category": "Cnblogs Posts List", |
| 190 | + "enablement": "vscode-cnb.isAuthorized" |
172 | 191 | }, |
173 | 192 | { |
174 | 193 | "command": "vscode-cnb.open-post-in-blog-admin", |
175 | 194 | "title": "在博客后台中编辑", |
176 | | - "category": "Cnblogs" |
| 195 | + "category": "Cnblogs", |
| 196 | + "enablement": "vscode-cnb.isAuthorized" |
177 | 197 | }, |
178 | 198 | { |
179 | 199 | "command": "vscode-cnb.open-workspace", |
|
343 | 363 | { |
344 | 364 | "command": "vscode-cnb.open-post-in-blog-admin", |
345 | 365 | "when": "false" |
| 366 | + }, |
| 367 | + { |
| 368 | + "command": "vscode-cnb.login", |
| 369 | + "when": "false" |
346 | 370 | } |
347 | 371 | ], |
348 | 372 | "view/item/context": [ |
|
424 | 448 | } |
425 | 449 | ], |
426 | 450 | "editor/context": [ |
| 451 | + { |
| 452 | + "command": "vscode-cnb.login", |
| 453 | + "when": "!vscode-cnb.isAuthorized", |
| 454 | + "group": "cnblogs@0" |
| 455 | + }, |
427 | 456 | { |
428 | 457 | "command": "vscode-cnb.save-post-file-to-cnblogs", |
429 | | - "when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file", |
| 458 | + "when": "resourceLangId == markdown", |
430 | 459 | "group": "cnblogs@1" |
431 | 460 | }, |
432 | 461 | { |
433 | 462 | "command": "vscode-cnb.open-post-in-blog-admin", |
434 | | - "when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file", |
| 463 | + "when": "resourceLangId == markdown", |
435 | 464 | "group": "cnblogs@2" |
436 | 465 | }, |
437 | 466 | { |
|
458 | 487 | } |
459 | 488 | ], |
460 | 489 | "explorer/context": [ |
| 490 | + { |
| 491 | + "command": "vscode-cnb.login", |
| 492 | + "when": "!vscode-cnb.isAuthorized" |
| 493 | + }, |
461 | 494 | { |
462 | 495 | "command": "vscode-cnb.save-post-file-to-cnblogs", |
463 | | - "when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file" |
| 496 | + "when": "resourceLangId == markdown" |
464 | 497 | }, |
465 | 498 | { |
466 | 499 | "command": "vscode-cnb.show-post-to-local-file-info", |
467 | | - "when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file" |
| 500 | + "when": "resourceLangId == markdown" |
468 | 501 | }, |
469 | 502 | { |
470 | 503 | "command": "vscode-cnb.open-post-in-blog-admin", |
471 | | - "when": "resourceLangId == markdown && vscode-cnb.isTargetWorkspace && resourceScheme == file" |
| 504 | + "when": "resourceLangId == markdown" |
472 | 505 | } |
473 | 506 | ] |
474 | 507 | }, |
|
0 commit comments