插件开发
0 篇文章
seehttps://github.com/siyuan-note/siyuan/blob/5129ad926a21176a352cf5f630e0651011bf9c83/app/src/boot/onGetConfig.ts#L167require('electron').ipcRenderer.on('siyuan-open-url',(event,url)=>{console.log(eve
查询某一个子文档下面不含标签的文档 seehttps://ld246.com/article/1723590423117SELECT*FROMblockswheretype='d'andpathlike'%20240725203634-j3t72jv/%'andtag=''andidnotin(SELECTroot_idFROMblockswheretype<>'d'andpathlike'%2024
seehttps://ld246.com/article/1734263645595//调用示例,当 callback 返回 true 时退出,返回 false 时取消退出 functionsleep(ms){returnnewPromise(resolve=>setTimeout(resolve,ms));}listenExit(async()=>{console.log('waiting');awaitsle
在数据库中实现 js 与 Sprig 模板的交互
seehttps://ld246.com/article/1734002304855 在数据库模板中可以利用 img 标签实现 js 与 Sprig 模板的交互,利用 js 来处理数据,就更方便了。比如:.action{$blocks:=queryBlocks"select*fromblockslimit1"}<span><imgsrc=""data-result='.action{toJson$blocks}'st
*思源笔记丨目前我用过的数据库 API 整理-链滴*[https://ld246.com/article/1733365731025#数据库设置属性-api-av-setAttributeViewBlockAttr](https://ld246.com/article/1733365731025#%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E7%BD%AE%E5%B1%9E
seehttps://ld246.com/article/1733921523331.action{$total:=0}.action{$id:=.id}.action{$blocks:=queryBlocks"select*fromblockswhereroot_id='?'andid!='?'"$id$id}.action{range$v:=$blocks}.action{$len:=len$v
思源模板功能新人指南:模板语法 + 函数 + md 块语法
推荐教程:思源模板功能新人指南:模板语法 + 函数 +md 块语法手把手数据库模板列简单使用指南快速预览 https://docs.siyuan-note.club/zh-Hans/reference/template/sprig/函数手册 https://docs.siyuan-note.club/zh-Hans/reference/template/siyuan.html 思源专有 https://www.to
/api/sqlite/flushTransactionseehttps://ld246.com/article/1733634555319#%E8%83%BD%E4%B8%8D%E8%83%BD%E7%A7%BB%E5%8A%A8%E5%90%8E%E5%8D%B3%E6%97%B6%E5%88%B7%E6%96%B0sqlite%E6%95%B0%E6%8D%AE%E5%BA%93await(
给 emoji 修改颜色.emoji{color:transparent;text-shadow:000#f2b05d;}给目录树排序.sy__fileul{display:flex;flex-direction:column;}/*带排序的 li 添加 order*/li{order:-1;}
要确定鼠标当前位于哪个元素内,JavaScript 提供了几种方法。你可以通过监听 mousemove事件并在事件处理函数中检查 event.target来得知鼠标所在的元素。此外,还可以使用 document.elementFromPoint方法来查找特定坐标下的最顶层元素。以下是两种常见的实现方式:使用 mousemove事件你可以为整个文档或某个容器添加一个 mousemove事件监听器,然后在
(()=>{//默认渠道名,可以根据需要修改 constchannel='siyuan-runjs';//创建 socket 客户端 createSocketClient(channel);//当收到消息时被调用 functiononReceivedMessage(event){letrequest=parseJson(event.data);letresult='';try{result=(newFunct
监听思源 main websocket
//seehttps://github.com/siyuan-note/siyuan/blob/1710194122495d282a51650441d9fc80804561bb/app/src/layout/Model.ts//seehttps://github.com/siyuan-note/siyuan/blob/1710194122495d282a51650441d9fc80804561bb/
//定义一个可观察的属性 window.siyuan._editorIsFullscreen=window.siyuan.editorIsFullscreen||false;Object.defineProperty(window.siyuan,'editorIsFullscreen',{get:function(){returnthis._editorIsFullscreen;},set:funct
functionwaitFor(conditionFn,timeoutMs=5000){returnnewPromise((resolve,reject)=>{conststart=Date.now();constcheck=()=>{if(typeofconditionFn==='string')conditionFn=()=>document.querySelector(conditionFn
//layout 的值"col"|"row"//id 块 id 或自动生成//attrHTML 块 domfunctiongenSBElement(layout,id,attrHTML){constsbElement=document.createElement("div");sbElement.setAttribute("data-node-id",id||Lute.NewNodeID());sbElemen
functionisTouchDevice(){return("ontouchstart"inwindow)&&navigator.maxTouchPoints>1;}functionisMobile(){return!!document.getElementById("sidebar");}functionisElectron(){returnnavigator.userAgent.include
functionpressKeyboard(keyInit,element){element=element||document.querySelector('[data-type="wnd"].layout__wnd--active.protyle:not(.fn__none).protyle-wysiwyg.protyle-wysiwyg--attr');keyInit["bubbles"]=t
functionupdateBlock(node){awaitfetchSyncPost('/api/block/updateBlock',{"dataType":"dom","data":node.outerHTML,"id":node.dataset.nodeId})}
asyncfunctionmyFetch(){constoriginalFetch=window.fetch;window.fetch=asyncfunction(url,...args){try{letconfig={};if(args.length>0&&typeofargs[0]==='object'){config=args[0];}//创建 Headers 对象以确保现有头部不会被覆盖 leth
记录精彩的程序人生
开始使用
分类
标签