a tool for shared writing and social publishing

Cannot terminate inline code after backspace or moving cursor #9

open
opened by metaflame.dev

After writing inline code, using backspace or otherwise moving the cursor seems to make it impossible to terminate the code section.

This behavior is consistent with other text styling, but while those styles can be terminated with their respective hotkeys/text style buttons, code blocks currently don't have that (or don't expose it to the user).

To reproduce:

  • Write some text in a text block, then follow with an inline code section by surrounding some text with `backticks`
    • Make sure the inline code is at the end of the text block
  • Press Backspace or move your cursor
    • Arrow keys, clicking with your mouse, or switching to a different block and back works
  • The inline code section now cannot be terminated

Some more observations (though these are also consistent with other text styling):

  • Making the whole text block inline code (i.e. no other text before or after) dooms the text block to be inline code forever*.
  • Pasting formatted text (or text without any formatting) works as intended, which can terminate an otherwise sticky inline code section.

Thanks, yeah ideal would probably be to add a hotkey / button for this, just need to find space for it in the toolbar! I think easy workaround for now is just make new block below and backspace to get regular text after the inline code.

I've long been tempted to add something like: https://github.com/ocavue/prosemirror-virtual-cursor to our editor. That one actually doesn't handle the end/start case but I think it would relatively easy to modify it to do so.

In normal editing this wouldn't change much, but if you are navigating around text with the arrow keys it does introduces an extra key press at decoration boundaries. Seems mostly fine to me though since you get visual feedback.

You can try out the rough behavior here: https://prosemirror-virtual-cursor.vercel.app/

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 3
AT URI
at://did:plc:c6te24qg5hx54qgegqylpqkx/sh.tangled.repo.issue/3m3si5g53cc22