Skip to content

Instantly share code, notes, and snippets.

@TfTHacker
Last active March 27, 2021 09:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TfTHacker/18d7055d89f6a8bff0f308f3e13d6e7d to your computer and use it in GitHub Desktop.
Save TfTHacker/18d7055d89f6a8bff0f308f3e13d6e7d to your computer and use it in GitHub Desktop.
// Roam42 is a prerequisite for this code, as it uses Roam42 libraries
// Install & Config:
// Add the code in this gist to a roam/js block in your roam graph and enable it
// change the text between quotes "" where it says let txt = "....."
// You can change the custom keys where it says hotkeys('ctrl+shift+7)
// this uses the hotkeys library, so explore more key combinations at: https://wangchujiang.com/hotkeys/
// after changing the text below, you may have to refresh Roam for it to take effect.
setTimeout(()=>{
Mousetrap.unbind('ctrl+shift+7')
Mousetrap.bind('ctrl+shift+7', function(event, handler) {
let txt = "{{[[TODO]]}} #action "
event.preventDefault()
if (event.srcElement.localName == "textarea") {
roam42.common.setEmptyNodeValue(document.getElementById(event.srcElement.id), txt + event.srcElement.innerHTML )
}
});
},5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment