Skip to content

Commit 20229b5

Browse files
committed
feat: add more supports for html posts
1 parent cfdb3b3 commit 20229b5

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,23 +1182,23 @@
11821182
},
11831183
{
11841184
"command": "vscode-cnb.post.show-local-file-info",
1185-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.editor.post-show-local-file-info"
1185+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.editor.post-show-local-file-info"
11861186
},
11871187
{
11881188
"command": "vscode-cnb.post.upload-file-no-confirm",
1189-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.editor.post-upload-file-no-confirm"
1189+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.editor.post-upload-file-no-confirm"
11901190
},
11911191
{
11921192
"command": "vscode-cnb.post.pull",
1193-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.editor.post-pull"
1193+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.editor.post-pull"
11941194
},
11951195
{
11961196
"command": "vscode-cnb.post.modify-setting",
1197-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.editor.post-modify-setting"
1197+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.editor.post-modify-setting"
11981198
},
11991199
{
12001200
"command": "vscode-cnb.post.open-in-blog-admin",
1201-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.editor.post-open-in-blog-admin"
1201+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.editor.post-open-in-blog-admin"
12021202
},
12031203
{
12041204
"command": "vscode-cnb.post.export-to-pdf",
@@ -1240,31 +1240,31 @@
12401240
},
12411241
{
12421242
"command": "vscode-cnb.post.upload-file",
1243-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.explorer.post-upload-file"
1243+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.explorer.post-upload-file"
12441244
},
12451245
{
12461246
"command": "vscode-cnb.post.pull",
1247-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.explorer.post-pull"
1247+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.explorer.post-pull"
12481248
},
12491249
{
12501250
"command": "vscode-cnb.post.modify-setting",
1251-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.explorer.post-modify-setting"
1251+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.explorer.post-modify-setting"
12521252
},
12531253
{
12541254
"command": "vscode-cnb.post.show-local-file-info",
1255-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.explorer.post-show-local-file-info"
1255+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.explorer.post-show-local-file-info"
12561256
},
12571257
{
12581258
"command": "vscode-cnb.post.open-in-blog-admin",
1259-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.explorer.post-open-in-blog-admin"
1259+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.explorer.post-open-in-blog-admin"
12601260
},
12611261
{
12621262
"command": "vscode-cnb.post.export-to-pdf",
12631263
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.explorer.post-export-to-pdf"
12641264
},
12651265
{
12661266
"command": "vscode-cnb.post.copy-link",
1267-
"when": "resourceLangId == markdown && config.cnblogsClient.menus.context.explorer.post-copy-link"
1267+
"when": "(resourceLangId == markdown || resourceLangId == html) && config.cnblogsClient.menus.context.explorer.post-copy-link"
12681268
}
12691269
]
12701270
},

src/cmd/post-list/upload-post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ async function parseFileUri(fileUri?: Uri) {
3838

3939
export async function saveLocalPost(localPost: LocalPost) {
4040
// check format
41-
if (!['.md', '.mkd'].some(x => localPost.fileExt === x)) {
42-
void Alert.warn('格式错误, 只支持 Markdown 文件')
41+
if (!['.md', '.mkd', '.htm', '.html'].some(x => localPost.fileExt === x)) {
42+
void Alert.warn('格式错误, 只支持 Markdown 或者 html 文件')
4343
return
4444
}
4545
const { post } = await PostService.getTemplate()

0 commit comments

Comments
 (0)