dvargas92495 / SmartBlocks

Useful examples from developer community for Roam42 SmartBlocks
147 stars 7 forks source link

Open a Block in the Sidebar from within a Workflow #190

Open eatondpe opened 3 years ago

eatondpe commented 3 years ago

✂️ Copy of your #42SmartBlock from Roam

📋 Describe the SmartBlock

This SmartBlock opens the current block in the sidebar by simulating a CTRL+SHIFT+O keyboard entry. This could be useful in workflows in which a certain block is desired to be pinned.

✅ Describe any prerequisites or dependencies that are required for this SmartBlock

None.

📷 Screenshot of your #42SmartBlock workflow/template from Roam

image

💡 Additional Info

mlava commented 3 years ago

Nice work @eatondpe.

I have been trying to find documentation of the roam42 keyboardlib and even had a look at source code. I couldn't find it.

Can you point me in the right direction? Cheers!

eatondpe commented 3 years ago

@mlava I wish I could. I still have not found any such documentation. I just found what I needed in someone else's code.

@roamhacker Do you know where we can find documentation on the keyboardlib you use?

eatondpe commented 3 years ago

@mlava Or I should say, I saw an example of including shiftKey=true and guessed that ctrlKey must also exist. The rest was just experimentation.

TfTHacker commented 3 years ago

If you search the whole roam42 code base you will see examples of its use. It is basically using some standard JS stuff for key events. It can't emulate everything in every scenario. So you have to test thoroughly. But it can emulate letters, numbers and combinations of holding CTRL, SHIFT, ALT

Also useful is the mouse click commands in 42. you can simulate left and right mouse clicks.

mlava commented 3 years ago

Thanks @eatondpe and @roamhacker

I will search the code. Cheers!