diff --git a/components/picgo/PicgoIndex.vue b/components/picgo/PicgoIndex.vue index b9420408..ab2d5406 100644 --- a/components/picgo/PicgoIndex.vue +++ b/components/picgo/PicgoIndex.vue @@ -275,6 +275,10 @@ const { picgoManageData, picgoManageMethods } = usePicgoManage(props, { margin: 16px 0 16px; } +.upload-status { + margin-top: 10px; +} + .upload-btn-list { } diff --git a/components/picgo/setting/PicgoConfigSetting.vue b/components/picgo/setting/PicgoConfigSetting.vue index 8074c3c5..68ce1f59 100644 --- a/components/picgo/setting/PicgoConfigSetting.vue +++ b/components/picgo/setting/PicgoConfigSetting.vue @@ -27,7 +27,9 @@
- {{ $t("setting.picgo.picgo.click.to.open") }} + {{ $t("setting.picgo.picgo.click.to.open") }} + @@ -50,6 +52,7 @@ import { onBeforeMount, reactive, ref } from "vue" import picgoUtil from "~/utils/otherlib/picgoUtil" import { LogFactory } from "~/utils/logUtil" +import siyuanBrowserUtil from "~/utils/otherlib/siyuanBrowserUtil" const logger = LogFactory.getLogger( "components/picgo/setting/PicgoConfigSetting.vue" @@ -89,6 +92,11 @@ function handleShowPicBedListChange(val: ICheckBoxValueType[]) { logger.debug("保存启用的图床", list) } +const handleOpenFile = () => { + const picgoCfgPath = picgoUtil.getPicgoCfgPath() + siyuanBrowserUtil.openPath(picgoCfgPath) +} + onBeforeMount(() => { // 获取图床列表 getPicBeds() diff --git a/locales/zh_CN.ts b/locales/zh_CN.ts index 4d0d9bc6..7075a3bd 100644 --- a/locales/zh_CN.ts +++ b/locales/zh_CN.ts @@ -444,5 +444,5 @@ export default { "setting.picgo.picbed.uploader.config.name": "图床配置名", "setting.picgo.picbed.uploader.config.name.placeholder": "请输入配置名称", "setting.picgo.index.tip": - "注意:此处上传的图片不会自动插入文档中,请手动点击复制按钮复制链接,然后Ctrl+V粘贴到文档中。该图片列表仅展示此文档包含的图片。", + "注意:此处上传的图片不会自动插入文档中,请手动点击复制按钮复制链接,然后 Ctrl+V 粘贴到文档中。该图片列表仅展示此文档包含的图片。", } diff --git a/public/lib/siyuan/publish-helper.js b/public/lib/siyuan/publish-helper.js index c809a54c..b42f893c 100644 --- a/public/lib/siyuan/publish-helper.js +++ b/public/lib/siyuan/publish-helper.js @@ -70,6 +70,16 @@ const initPublishHelper = () => { window.syp = { pageId: undefined, renderPublishHelper: () => {}, + openPath: () => {}, + } + + /** + * 打开文件 + * @param absFilePath 文件绝对路径 + */ + window.syp.openPath = (absFilePath) => { + const { shell } = window.require("electron") + shell.openPath(absFilePath) } /** diff --git a/utils/otherlib/siyuanBrowserUtil.js b/utils/otherlib/siyuanBrowserUtil.js index 84bb0bfa..6738b016 100644 --- a/utils/otherlib/siyuanBrowserUtil.js +++ b/utils/otherlib/siyuanBrowserUtil.js @@ -117,10 +117,28 @@ const fitTheme = () => { console.log("适配customstyle完成=>", customstyle) } +/** + * 打开文件 + * @param absFilePath 文件绝对路径 + */ +const openPath = (absFilePath) => { + const syWin = getSiyuanWindow() + + if (syWin.syp && syWin.syp.openPath) { + // 打开弹窗 + syWin.syp.openPath(absFilePath) + } else { + ElMessage.warning( + "openPath失败,未找到hook方法,请在自定义js片段添加 import('/widgets/sy-post-publisher/lib/siyuanhook.js') ,并重启思源笔记" + ) + } +} + // 统一访问入口 const siyuanBrowserUtil = { fitTheme, getSiyuanWindow, + openPath, } export default siyuanBrowserUtil