判断文档树文件夹是否展开 letclicking=false;ul.addEventListener('click',async(event)=>{constli=event.target.closest('li[data-node-id]');if(li.querySelector('.b3-list-item__toggle.fn__hidden'))return;if(clicking)return;clicking= 思源 链滴社区
sql 通过 parent_id 递归获取祖先元素 seehttps://ld246.com/article/1743473205973 需求:比如如下数据库中,主键 id 是事件列,比如图中的任务项“工时登记”;然后项目列是模板列,在这个模板中获取“工作备忘”这个文档的文档标题和 h2 标题(通过文档中的任务项“工时登记”的块 id 获取,这个 id 也同时是数据库中的主键 id);即通过任务块的 id 获取该文档的标题和任务块的上级 h2 标题,然后实现方式是用数据库的模板 思源 链滴社区 sql 模板 思源
URL Scheme 转 siyuan URLScheme 转 siyuan:可参考 URLScheme:思源笔记一款利用挂件 Web 服务重定向至笔记内链接的挂件(专治各种不支持 URLScheme 的软件)或 https://sspai.com/post/66896 笔记
js 代码,左键展开文档树,中键打开文档 js 代码,左键展开文档树,中键打开文档 seehttps://ld246.com/article/1736401552973 代码//左侧文件夹中键打开和点击展开//pc 版中键打开,单击展开//触屏版长按打开点击展开//seehttps://ld246.com/article/1736401552973(()=>{//是否更改空文件夹图标 constisUpdateFolderIconWhenItEmpt 笔记
链滴自动签到 puppeteer 脚本 - 20240825072507-x4ydcsu 链滴自动签到 puppeteer 脚本//用户名和密码,必须 constusername="";constpassword="";//设置浏览器安装路径,必须,如果填空,则使用 puppeteer 模式而不是 puppeteer-core//Windows 用户可能是"C:\\ProgramFiles\\Google\\Chrome\\Application\\chrome.exe",注意这里的路径要用\转义 co 笔记
插件开发 插件开发插件开发快速指南 https://docs.siyuan-note.club/zh-Hans/guide/plugin/sy-plugin-dev-quick-start.html 后端 api 接口 https://github.com/siyuan-note/siyuan/blob/master/kernel/api/router.go 笔记
刷新文档 seehttps://github.com/siyuan-note/siyuan/issues/10243protyle.reloadthis.protyleSlash=[{filter:["insertemoji\u{1F60A}","\u63D2\u5165\u8868\u60C5\u{1F60A}","crbqwx"],html:`<divclass="b3-list-item__first" 思源 插件开发
提供重建单个文档索引的 API seehttps://github.com/siyuan-note/siyuan/issues/5719 这个接口暂时不加入 API 文档中;使用方式如下:POSThttp://127.0.0.1:6806/api/filetree/reindexTree{"path":"/data/20210808180117-czj9bvb/20200812220555-lj3enxa.sy"} 思源 插件开发
生成文档树列表项 seehttps://ld246.com/article/1741359650489pc 端//第一步调用 listDocsByPath 获取文档树文档信息//fetchSyncPost('/api/filetree/listDocsByPath',{notebook:'20240723175050-336994k',path:'/20240728220858-adaleye'})//第二步调用 genFi 思源 插件开发
思源事件原理 思源把插件名称生成注释 dom 结点,然后把相关事件绑定其上,在需要触发的地方通过遍历所有插件,调用 emit 进行触发。seehttps://github.com/siyuan-note/siyuan/blob/0b0c27b0bad3e2a073f61ed28c6ce76d2f2b4b07/app/src/plugin/EventBus.ts#L7 示例:seehttps://ld246.com/arti 思源 插件开发
行内自定义元素和属性 seehttps://github.com/siyuan-note/siyuan/issues/13325 关联:块自定义元素和属性只能用 span,且不能嵌套,只能叠加自定义属性 custom-xxx 和 data-type 值修改或生成后,需要调用 input 事件触发比如:letmemoELement=document.querySelector(`span[data-id="${newBlockId}"]` 思源 插件开发
创建指定日期的日记 seehttps://ld246.com/article/1741777522652 参考这个:https://github.com/frostime/siyuan-plugin-kits/blob/667c2621ebc6fa11028e4e53e447afc5f00639ea/src/dailynote.ts#L72 不想自己实现也可以手动安装 npminstall@frostime/siyuan-p 思源 插件开发
文档树和大纲显示不全自动换行 seehttps://ld246.com/article/1727826244841seehttps://ld246.com/article/1741790614241.b3-list-item{line-height:160%;}.b3-list-item__text{word-wrap:break-word;-webkit-line-clamp:inherit;word-break:inheri 思源 链滴社区
给高亮搜索插件自动填入选中文本 seehttps://ld246.com/article/1729773295142 必须设置快捷键 ctrl+f才行(()=>{//等待元素渲染完成后执行 functionwhenElementExist(selector){returnnewPromise(resolve=>{constcheckForElement=()=>{letisExist=false;if(typeofselector== 思源 链滴社区
给图片添加右侧菜单 图片子菜单宽度 25% 调整到主菜单 seehttps://ld246.com/article/1735472731026https://gitee.com/wish163/mysoft/blob/main/%E6%80%9D%E6%BA%90/%E5%A4%8D%E5%88%B6%E6%88%96%E7%A7%BB%E5%8A%A8%E5%AD%90%E8%8F%9C%E5%8D%95%E5%88%B0 思源 链滴社区