Open TfTHacker opened 3 years ago
#42SmartBlock grab block, insert text with aliase
<%JA:```javascript var cb = await navigator.clipboard.readText(); var cbQ = cb.replace('((','').replace('))',''); var query = await roam42.common.getPageNamesFromBlockUidList([cbQ]); if(!query){ roam42.help.displayMessage('Invalid block reference in the clipboard',20000); return ''; } roam42.smartBlocks.activeWorkflow.vars["blockText"] = query[0][0].string; roam42.smartBlocks.activeWorkflow.vars["blockUID"] = cb; roam42.smartBlocks.activeWorkflow.vars["blockParentTitle"] = `[[${query[0][1].title}]]`; console.log(query) return '';```%><%NOBLOCKOUTPUT%>
<%GET:blockParentTitle%> <%GET:blockText%>[*](<%GET:blockUID%>)
<%CURSOR%>
Shows how to use the Roam42 API to grab details about a block and use them in your SmartBlock
Short video in action: https://www.loom.com/share/fe30c550b6f4463d8987a5ae61f1438f
✂️ Copy of your #42SmartBlock from Roam
📋 Describe the SmartBlock
Shows how to use the Roam42 API to grab details about a block and use them in your SmartBlock
Short video in action: https://www.loom.com/share/fe30c550b6f4463d8987a5ae61f1438f
📷 Screenshot of your #42SmartBlock workflow/template from Roam