diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index fc7977c..25d76d8 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -1,7 +1,6 @@ { "importer": "Importer", "selectFile": "Select file", - "cancel": "Cancel", "startImport": "Single import", "importerLoaded": "Importer loaded", "importerUnloaded": "Importer unloaded", @@ -35,5 +34,16 @@ "tempCountExists": "Please clean up the temporary files before batch import", "reportBug1": "Encounter problems? , to the developer terwer ", "reportBug2": "feedback", - "reportBug3": " bar~" + "reportBug3": " bar~", + "setting": "setting", + "cancel": "Cancel", + "save": "Save", + "customFnHandler": "Custom handler", + "customFnSwitch": "Custom handler switch", + "customFnSwitchTips": "Enable or disable custom handlers", + "customFnHandlerTips": "You can customize the processing function here, and it will be called automatically during the import process. Please note: modifying this may cause the import to not work. If there is a problem, you can disable the custom processing function", + "customFnHandlerPlaceholder": "Custom handler", + "enableCustomFn": "Enable custom functions", + "enableCustomFnTips": "Are you sure you want to enable custom functions? This action may cause imports to be unavailable. Please confirm that you have understood how custom functions work?", + "importConfigSaveSuccess": "Configuration saved successfully" } diff --git a/src/i18n/zh_CN.json b/src/i18n/zh_CN.json index 2ecaa7e..5683a80 100644 --- a/src/i18n/zh_CN.json +++ b/src/i18n/zh_CN.json @@ -1,7 +1,6 @@ { "importer": "导入插件", "selectFile": "选择文件", - "cancel": "取消", "startImport": "单个导入", "importerLoaded": "导入工具已加载", "importerUnloaded": "导入工具已卸载", @@ -28,7 +27,7 @@ "importFolder": "批量导入", "importFolderTip": "支持混合.epub,.docx,.opml", "importNotRecursive1": "1、不递归", - "importNotRecursive2": "2、不支持MD,批量导入MD请使用笔记本自带功能。", + "importNotRecursive2": "2、不支持MD,批量导入MD请使用笔记本自带功能", "importNotRecursive3": "3、不支持html,因为安全限制,浏览器现在无法获取绝对路径,可通过单个导入(支持资源文件)", "importTipNotAllowed": "不允许的文件类型:", "importError": "导入出错:", @@ -39,5 +38,16 @@ "tempCountExists": "请先清理临时文件在进行批量导入", "reportBug1": "遇到问题? 发邮件到 youweics@163.com 或者 给开发者 terwer ", "reportBug2": "反馈一下", - "reportBug3": " 吧~" + "reportBug3": " 吧~", + "setting": "设置", + "cancel": "取消", + "save": "保存", + "customFnHandler": "自定义处理函数", + "customFnSwitch": "自定义处理函数开关", + "customFnSwitchTips": "启用或者禁用自定义处理函数", + "customFnHandlerTips": "可以在这里自定义处理函数,导入过程中会自动调用,请注意:修改此处可能会导致导入不工作,若出现问题可禁用自定义处理函数。正则表达式在线测试可参考:", + "customFnHandlerPlaceholder": "自定义处理函数", + "enableCustomFn": "启用自定义函数", + "enableCustomFnTips": "确认要启用自定义函数吗,此操作可能导致导入不可用,请确认您已经了解自定义函数的工作原理?", + "importConfigSaveSuccess": "配置保存成功" } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 1eb3130..48e4ded 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ * questions. */ -import { App, IObject, Plugin } from "siyuan" +import { App, getFrontend, IObject, Plugin } from "siyuan" import { createLogger } from "./utils/simple-logger" import KernelApi from "./api/kernel-api" import { isDev, mediaDir } from "./Constants" @@ -41,10 +41,13 @@ import { simpleLogger } from "zhi-lib-base" export default class ImporterPlugin extends Plugin { public logger public kernelApi: KernelApi + public isMobile: boolean constructor(options: { app: App; id: string; name: string; i18n: IObject }) { super(options) + const frontEnd = getFrontend() + this.isMobile = frontEnd === "mobile" || frontEnd === "browser-mobile" this.logger = simpleLogger("index", "importer", isDev) this.kernelApi = new KernelApi() } diff --git a/src/lib/ImportSetting.svelte b/src/lib/ImportSetting.svelte new file mode 100644 index 0000000..80cd5c4 --- /dev/null +++ b/src/lib/ImportSetting.svelte @@ -0,0 +1,128 @@ + + + + +