Skip to content

Commit b626917

Browse files
committedJun 1, 2023
feat: 优化帮助文档
·
v1.8.1v1.6.0
1 parent bc8c878 commit b626917

File tree

5 files changed

+55
-418
lines changed

5 files changed

+55
-418
lines changed
 

‎src/i18n/en_US.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"loading": "Loading",
2222
"importFile": "Importing files",
2323
"importTip": "Support .md, .epub, .docx, .html, .opml",
24+
"importTipHelp": "Move the mouse up to view the help details",
2425
"importSingleNotice": "Convert the document to a temporary Markdown file, then create the document",
2526
"importFolder": "Batch Import",
2627
"importFolderTip": "Batch import the supported files under the selected folder, and support mixed formats",
@@ -32,5 +33,7 @@
3233
"clean": "Delete",
3334
"tempCount": "temporary files",
3435
"tempCountExists": "Please clean up the temporary files before batch import",
35-
"supportedTypes": "Currently supported formats: .epub, .docx, .html, .opml"
36-
}
36+
"reportBug1": "Encounter problems? , to the developer terwer ",
37+
"reportBug2": "feedback",
38+
"reportBug3": " bar~"
39+
}

‎src/i18n/zh_CN.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,22 @@
2121
"loading": "加载中",
2222
"importFile": "单个导入",
2323
"importTip": "支持.md, .epub, .docx, .html, .opml",
24-
"importSingleNotice": "将文档转换成Markdown临时文件,然后创建文档",
24+
"importTipHelp": "鼠标移上来查看帮助详情",
25+
"importSingleNotice1": "1、将文档转换成Markdown临时文件,然后创建文档",
26+
"importSingleNotice2": "2、html资源文件夹(仅PC客户端)必须是 [文件名]_files",
2527
"importFolder": "批量导入",
2628
"importFolderTip": "支持混合.epub,.docx,.html,.opml",
27-
"importNotRecursive": "不递归,不支持MD,批量导入MD请使用笔记本自带功能",
29+
"importNotRecursive1": "1、不递归",
30+
"importNotRecursive2": "2、不支持MD,批量导入MD请使用笔记本自带功能。",
31+
"importNotRecursive3": "3、html资源文件夹(仅PC客户端)必须是 [文件名]_files",
2832
"importTipNotAllowed": "不允许的文件类型:",
2933
"importError": "导入出错:",
3034
"cleanTemp": "清理临时文件",
3135
"tempTotal": "",
3236
"clean": "删除",
3337
"tempCount": "个临时文件",
3438
"tempCountExists": "请先清理临时文件在进行批量导入",
35-
"supportedTypes": "目前支持的格式:.md, .epub, .docx, .html, .opml"
39+
"reportBug1": "遇到问题? 发邮件到 youweics@163.com 或者 给开发者 terwer ",
40+
"reportBug2": "反馈一下",
41+
"reportBug3": " 吧~"
3642
}

‎src/lib/ImportForm.svelte

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,10 @@
225225
<div class="fn__flex b3-label config__item">
226226
<div class="fn__flex-1 fn__flex-center">
227227
{pluginInstance.i18n.importFile}
228-
<div class="b3-label__text">
229-
<div>{pluginInstance.i18n.importTip}</div>
230-
<div class="highlight">{pluginInstance.i18n.importSingleNotice}</div>
228+
<div class="b3-label__text tips">
229+
<div>{pluginInstance.i18n.importTip} <span class="sign">({pluginInstance.i18n.importTipHelp})</span></div>
230+
<div class="highlight">{pluginInstance.i18n.importSingleNotice1}</div>
231+
<div class="highlight">{pluginInstance.i18n.importSingleNotice2}</div>
231232
</div>
232233
</div>
233234
<span class="fn__space" />
@@ -249,8 +250,10 @@
249250
<div class="fn__flex-1 fn__flex-center">
250251
{pluginInstance.i18n.importFolder}
251252
<div class="b3-label__text">
252-
<div>{pluginInstance.i18n.importFolderTip}</div>
253-
<div class="highlight">{pluginInstance.i18n.importNotRecursive}</div>
253+
<div>{pluginInstance.i18n.importFolderTip} <span class="sign">({pluginInstance.i18n.importTipHelp})</span></div>
254+
<div class="highlight">{pluginInstance.i18n.importNotRecursive1}</div>
255+
<div class="highlight">{pluginInstance.i18n.importNotRecursive2}</div>
256+
<div class="highlight">{pluginInstance.i18n.importNotRecursive3}</div>
254257
</div>
255258
</div>
256259
<span class="fn__space" />
@@ -284,7 +287,11 @@
284287
</button>
285288
</div>
286289

287-
<div class="fn__flex b3-label config__item">{pluginInstance.i18n.supportedTypes}</div>
290+
<div class="fn__flex b3-label config__item">
291+
{pluginInstance.i18n.reportBug1}
292+
&nbsp;<a href="https://github.com/terwer/siyuan-plugin-importer/issues/new" target="_blank">{pluginInstance.i18n.reportBug2}</a>&nbsp;
293+
{pluginInstance.i18n.reportBug3}
294+
</div>
288295
</div>
289296
</div>
290297

@@ -300,10 +307,24 @@
300307
301308
.highlight {
302309
color: red;
310+
display: none; /* 初始状态下隐藏 */
303311
}
304312
305313
.link {
306314
color: var(--b3-theme-primary);
307315
cursor: pointer;
308316
}
317+
318+
.tips{
319+
cursor: pointer;
320+
}
321+
322+
.b3-label__text .sign{
323+
cursor: pointer;
324+
color: var(--b3-theme-primary);
325+
}
326+
327+
.config__item:hover .highlight {
328+
display: block;
329+
}
309330
</style>

‎src/lib/ImportForm_bak.svelte

Lines changed: 0 additions & 402 deletions
This file was deleted.

‎src/service/importService.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,27 @@ export class ImportService {
3939
const fromFilename = file.name
4040

4141
// 修正文件名
42-
let filename = fromFilename.substring(0, fromFilename.lastIndexOf("."))
42+
const originalFilename = fromFilename.substring(0, fromFilename.lastIndexOf("."))
4343
// 去除标题多余的空格,包括开始中间以及结尾的空格
44-
filename = filename.replace(/\s+/g, "")
44+
const filename = originalFilename.replace(/\s+/g, "")
4545
const toFilename = `${filename}.md`
4646

4747
// 扩展名
4848
const ext = fromFilename.split(".").pop().toLowerCase()
4949

5050
// md 直接返回
51-
if (ext === "md" || ext === "html") {
52-
pluginInstance.logger.info(`import md from ${file.path}`)
53-
return file.path
51+
if (ext === "md") {
52+
const filePath = file.path
53+
pluginInstance.logger.info(`import md from ${filePath}`)
54+
return filePath
55+
}
56+
57+
if (ext === "html") {
58+
// 仅在客户端复制资源文件
59+
const filePath = file.path
60+
const lastSlashIndex = filePath.lastIndexOf("/")
61+
const dirPath = filePath.substring(0, lastSlashIndex)
62+
pluginInstance.logger.info(`${dirPath}${originalFilename}_files`)
5463
}
5564

5665
// =================================================

0 commit comments

Comments
 (0)
Please sign in to comment.