Auto-collapse on DONE

Is there a way to auto-collapse a block when it’s marked DONE?

2 Likes
  • Is this about saving just one click?
  • Is collapsing necessary or is hiding children enough?
  • Should old tasks become collapsed as well or only what is DONE from now on?

Sorry for the delay.

  • Is this about saving just one click?

Yes, when using keyboard it saves Ctrl + ArrowUp

  • Is collapsing necessary or is hiding children enough?

What is “hiding children”, sorry? If you mean recursive or not, then no, recursive nested blocks should not react.

  • Should old tasks become collapsed as well or only what is DONE from now on?

Why old tasks? I mean only the current one, that you’re DONE-ing.

Try adding the following code in file custom.js :

document.addEventListener("keyup", (e)=>{
    if (e.code === "Enter" && e.ctrlKey) {
        const block = logseq.api.get_current_block()
        if (block.marker === "DONE") logseq.api.set_block_collapsed(block.uuid, true)
    }
});
2 Likes