Wilson@思源

目 录

发送消息showMessage自定义窗口内容

js
// 发送通知 showMessage(`模板导出成功
路径:${templatesPath.replace(/\/+$/, '')}`); if(isPc()) { const msgContent = await whenElementExist("#message .b3-snackbar__content"); const br = document.createElement("br"); const button = document.createElement("button"); button.classList.add('b3-button', 'b3-button--white'); button.textContent = '打开文件位置'; button.onclick = async () => { const file = require('path').join(siyuan.config.system.workspaceDir, tplFile); require('electron').ipcRenderer.send("siyuan-open-folder", file); }; msgContent.appendChild(br); msgContent.appendChild(button); } function showMessage(message, delay) { fetchSyncPost("/api/notification/pushMsg", { "msg": message, "timeout": delay || 7000 }); }