Skip to content

Commit bc8c878

Browse files
committedJun 1, 2023
feat: 显示临时文件夹路径,支持桌面端、桌面端浏览器
·
v1.8.1v1.6.0
1 parent eb6fb1b commit bc8c878

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed
 

‎plugin.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"darwin"
1111
],
1212
"frontends": [
13-
"desktop"
13+
"desktop",
14+
"browser-desktop"
1415
],
1516
"displayName": {
1617
"default": "Importer",

‎src/i18n/en_US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"selectNotebookTip": "Imported target notebook, selected",
2121
"loading": "Loading",
2222
"importFile": "Importing files",
23-
"importTip": "Convert epub, docx and other formats into Markdown temporary files, and then create documents",
23+
"importTip": "Support .md, .epub, .docx, .html, .opml",
24+
"importSingleNotice": "Convert the document to a temporary Markdown file, then create the document",
2425
"importFolder": "Batch Import",
2526
"importFolderTip": "Batch import the supported files under the selected folder, and support mixed formats",
2627
"importNotRecursive": "Not recursive",

‎src/i18n/zh_CN.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
"targetNotebook": "目标笔记本",
2020
"selectNotebookTip": "导入的目标笔记本,已选",
2121
"loading": "加载中",
22-
"importFile": "导入文件",
23-
"importTip": "将 epub, docx 等格式转换成Markdown临时文件,然后创建文档",
22+
"importFile": "单个导入",
23+
"importTip": "支持.md, .epub, .docx, .html, .opml",
24+
"importSingleNotice": "将文档转换成Markdown临时文件,然后创建文档",
2425
"importFolder": "批量导入",
25-
"importFolderTip": "将当前选择的文件夹下支持的文件批量导入",
26-
"importNotRecursive": "不递归",
26+
"importFolderTip": "支持混合.epub,.docx,.html,.opml",
27+
"importNotRecursive": "不递归,不支持MD,批量导入MD请使用笔记本自带功能",
2728
"importTipNotAllowed": "不允许的文件类型:",
2829
"importError": "导入出错:",
2930
"cleanTemp": "清理临时文件",

‎src/lib/ImportForm.svelte

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
<script lang="ts">
2727
import ImporterPlugin from "../index"
2828
import { loadImporterConfig, saveImporterConfig } from "../store/config"
29-
import { showMessage } from "siyuan"
29+
import { showMessage, confirm } from "siyuan"
3030
import { onMount } from "svelte"
3131
import { ImportService } from "../service/importService"
32+
import { workspaceDir } from "../Constants"
3233
3334
export let pluginInstance: ImporterPlugin
3435
export let dialog
@@ -114,6 +115,17 @@
114115
})
115116
}
116117
118+
const openTempFolder = () => {
119+
confirm("⚠️临时文件路径", `${workspaceDir}/temp/convert/pandoc`, () => {})
120+
}
121+
122+
const handleKeyDown = (event) => {
123+
if (event.key === "Enter" || event.key === " ") {
124+
// 处理按键事件
125+
event.preventDefault()
126+
}
127+
}
128+
117129
// =================
118130
// 单文件转换开始
119131
// =================
@@ -213,7 +225,10 @@
213225
<div class="fn__flex b3-label config__item">
214226
<div class="fn__flex-1 fn__flex-center">
215227
{pluginInstance.i18n.importFile}
216-
<div class="b3-label__text">{pluginInstance.i18n.importTip}</div>
228+
<div class="b3-label__text">
229+
<div>{pluginInstance.i18n.importTip}</div>
230+
<div class="highlight">{pluginInstance.i18n.importSingleNotice}</div>
231+
</div>
217232
</div>
218233
<span class="fn__space" />
219234
<button class="b3-button b3-button--outline fn__flex-center fn__size200" style="position: relative">
@@ -234,7 +249,8 @@
234249
<div class="fn__flex-1 fn__flex-center">
235250
{pluginInstance.i18n.importFolder}
236251
<div class="b3-label__text">
237-
{pluginInstance.i18n.importFolderTip}<span class="selected">{pluginInstance.i18n.importNotRecursive}</span>
252+
<div>{pluginInstance.i18n.importFolderTip}</div>
253+
<div class="highlight">{pluginInstance.i18n.importNotRecursive}</div>
238254
</div>
239255
</div>
240256
<span class="fn__space" />
@@ -252,6 +268,8 @@
252268
<div class="b3-label__text">
253269
{pluginInstance.i18n.tempTotal} <span class="selected"> [ {tempCount} ] </span>
254270
{pluginInstance.i18n.tempCount}
271+
272+
<span class="link" on:click={openTempFolder} on:keydown={handleKeyDown}>显示临时文件夹路径</span>
255273
</div>
256274
</div>
257275
<span class="fn__space" />
@@ -279,4 +297,13 @@
279297
color: red;
280298
padding: 0 4px;
281299
}
300+
301+
.highlight {
302+
color: red;
303+
}
304+
305+
.link {
306+
color: var(--b3-theme-primary);
307+
cursor: pointer;
308+
}
282309
</style>

‎src/service/importService.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,6 @@ export class ImportService {
101101
return toFilePath
102102
}
103103

104-
105-
public static async uploadMd(pluginInstance: ImporterPlugin, file: any) {
106-
107-
}
108-
109-
public static async uploadHtml(pluginInstance: ImporterPlugin, file: any) {
110-
111-
}
112-
113104
public static async singleImport(pluginInstance: ImporterPlugin, toFilePath: string, toNotebookId: string) {
114105
const ext = toFilePath.split(".").pop().toLowerCase()
115106
const isMd = ext === "md"

0 commit comments

Comments
 (0)
Please sign in to comment.