Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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