Last active
March 12, 2021 17:20
-
-
Save TfTHacker/94d0d3e63501490ce953bb45c95d2069 to your computer and use it in GitHub Desktop.
Roam on Chromebook - Add shortcut keys for moving blocks up and down in outline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enable the Move block up and down from keyboard on a Chromebook | |
// Use CTRL+ALT+K (move block up) and CTRL+ALT+J (move block down) | |
// This code is dependent on Roam42, thus the 10 second delay to | |
// allow roam and roam42 to initiialize key assignments can easily | |
// be changed. See the Mousetrap documentation for key support: | |
// https://craig.is/killing/mice | |
// ADD TO ROAM | |
// 1) Create new page & name it something you will remember | |
// 2) In empty block type {{[[roam/js]]}} | |
// 3) Create a block under that one, indent it (tab key) | |
// 4) Create /Code Block. A new code field appears | |
// 5) Copy code from below into the code field | |
// 6) Click Yes, I know what I am doing button | |
setTimeout(()=>{ | |
Mousetrap.bind("ctrl+alt+j",()=> { | |
roam42KeyboardLib.simulateKey(40,100,{altKey:true,shiftKey:true}); | |
document.activeElement.scrollIntoViewIfNeeded(); | |
}) | |
Mousetrap.bind("ctrl+alt+k", ()=> { | |
roam42KeyboardLib.simulateKey(38,100,{altKey:true,shiftKey:true}); | |
document.activeElement.scrollIntoViewIfNeeded(); | |
}) | |
},10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment