"+" button that would appear under the block bullet when hovering the bullet? Can it be done with JS?

I lately posted quite a bit here and been doing Logseq Workflow optimization of various kinds but this is a recurring grievance for me. I always have to either Ctrl+Click+Enter+Enter or straight away Click, Click again to place the cursor at the end of the Block (as it is eandomly placed sometimes at the begining of the block, sometimes at the end, etc), which are at least 3 actions for starting a new block. I have a right sidebar quick capture block that I sometimes use but I would also like to have the option to insert a block in between other blocks and this could be done by coding a on-mouse-hover “+” button similar to the one that already appears at the very bottom of the journal.

Maybe even the same behavior or code can be invoked when hovering each bullet and clicking it should insert a new bullet with same indentation as the ones its bullet was clicked.

  • Put this in custom.js:
    document.addEventListener("keyup", (e)=>{
        if (e.code === "KeyN" && e.altKey && e.ctrlKey) {
            const blockId = logseq.api.get_current_block().uuid
            logseq.api.insert_block(blockId, "", {focus: true, sibling: true})
  • Press Ctrl + Alt + n to add a block right under the current one.
  • Adjust the second line to define the combination of your preference.
1 Like

If I am working in the sidebar I’d have to Ctrl+Click a block to be able to Ctrl+Alt+n for new one under it and Ctrl+Click doesn’t always work, sometimes it goes straight to Edit Mode even if I am using Ctrl+Click so I would rather do a mouse action to get a new block.

Isn’t there anyway to “invoke” the code for the actual “+” button that appears when you want to create a block at the end of the stack?

I see the HTML code for it with Ctrl+Shift+I:

Maybe make a “On-mouse-over” action for all bullets of sorts …

Variation for inserting a block either before/above or after/below: Keyboard shortcuts: Create block {before, after} current block at same indentation level