Skip to content

Commit

Permalink
Merge pull request #42 from terwer/dev
Browse files Browse the repository at this point in the history
fix: 新增校验,批量导入之前必须清除临时文件
  • Loading branch information
terwer authored May 24, 2023
2 parents 875b3ac + 508999d commit 08c06d1
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 2 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ Import epub, docx, html, etc. into Siyuan notes. Currently supported formats: .e
After the installation is complete, find the `Importer` icon on the top right toolbar, and click to follow the pop-up window.

## Changelog

**v1.5.1 major update**

### Features and bug fixes
* [#33](https://github.com/terwer/siyuan-plugin-importer/issues/33) Support batch import of selected directories ([2e58a37](https://github.com/terwer/siyuan-plugin-importer/commit/2e58a37cc833061b8d12f1c9be96ad72a2df98f2))
* [#38](https://github.com/terwer/siyuan-plugin-importer/issues/38) line break problem([74c00c0](https://github.com/terwer/siyuan-plugin-importer/commit/74c00c095aae20077b7a79709c2d2721859f947e))
* Uninstall does not delete configuration ([a913034](https://github.com/terwer/siyuan-plugin-importer/commit/a9130349120f03e2705d886de9d3a470fa019513))
* Support manual cleaning of temporary files ([5687248](https://github.com/terwer/siyuan-plugin-importer/commit/5687248f1aae2629ced3171f4b15f2def9babca0))
* Support md file import, md does not need to be converted, other formats, convert first, then import
### Development refactoring
* Move the i18n folder to the src directory ([0234c50](https://github.com/terwer/siyuan-plugin-importer/commit/0234c509a2dbadf851bce73ddc961c305cded145))
*
**v1.5.0 major update**

- Solve the problem that after importing epub, the pictures in it will appear in the unreferenced resources, which are easy to be cleared by mistake. Now after the document is imported, the resource files will not appear in the unreferenced ones. Unreferenced resources are visible after the document is deleted.
Expand Down
10 changes: 10 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
安装完成后,在顶部右侧工具栏找到 `导入工具` 图标,点击按照弹窗操作即可。

## 更新历史
**v1.5.1 主要更新**

### 特性和问题修复
* [#33](https://github.com/terwer/siyuan-plugin-importer/issues/33) 支持选择目录批量导入 ([2e58a37](https://github.com/terwer/siyuan-plugin-importer/commit/2e58a37cc833061b8d12f1c9be96ad72a2df98f2))
* [#38](https://github.com/terwer/siyuan-plugin-importer/issues/38) 换行符问题 ([74c00c0](https://github.com/terwer/siyuan-plugin-importer/commit/74c00c095aae20077b7a79709c2d2721859f947e))
* 卸载不删除配置 ([a913034](https://github.com/terwer/siyuan-plugin-importer/commit/a9130349120f03e2705d886de9d3a470fa019513))
* 支持手动清理临时文件 ([5687248](https://github.com/terwer/siyuan-plugin-importer/commit/5687248f1aae2629ced3171f4b15f2def9babca0))
* 支持md文件导入,md无需转换,其他格式,先转换,后导入
### 开发重构
* i18n文件夹移动到src目录 ([0234c50](https://github.com/terwer/siyuan-plugin-importer/commit/0234c509a2dbadf851bce73ddc961c305cded145))

**v1.5.0 主要更新**

Expand Down
11 changes: 10 additions & 1 deletion src/api/kernel-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@ class KernelApi extends BaseApi {
*/
public async convertPandoc(type: string, from: string, to: string): Promise<SiyuanData> {
const args = {
args: ["--to", type, from, "-o", to, "--extract-media", `${mediaDir}/${shortHash(from)}`, "--wrap=none"],
args: [
"--to",
type,
from,
"-o",
to,
"--extract-media",
`${mediaDir}/${shortHash(from).toLowerCase()}`,
"--wrap=none",
],
}
return await this.siyuanRequest("/api/convert/pandoc", args)
}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"cleanTemp": "clean up temporary files",
"clean": "Delete",
"tempCount": "temporary files",
"tempCountExists": "Please clean up the temporary files before batch import",
"supportedTypes": "Currently supported formats: .epub, .docx, .html, .opml"
}
1 change: 1 addition & 0 deletions src/i18n/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"cleanTemp": "清理临时文件,共",
"clean": "删除",
"tempCount": "个临时文件",
"tempCountExists": "请先清理临时文件在进行批量导入",
"supportedTypes": "目前支持的格式:.md, .epub, .docx, .html, .opml"
}
6 changes: 6 additions & 0 deletions src/lib/ImportForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@
// 批量转换开始
// =================
const selectFolder = async () => {
// 批量导入之前先清空临时文件
if (tempCount > 0) {
showMessage(`${pluginInstance.i18n.tempCountExists}`, 1000, "error")
return
}
const result = await window.showDirectoryPicker()
dialog.destroy()
Expand Down

0 comments on commit 08c06d1

Please sign in to comment.