ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
26.67k stars 2.23k forks source link

[Bug]: Typing over fully-selected codeBlock contents fails to insert typed character #4255

Open Nantris opened 1 year ago

Nantris commented 1 year ago

Which packages did you experience the bug in?

extension-codeblock-lowlight

What Tiptap version are you using?

2.1.0-rc.12

What’s the bug you are facing?

The image below is for my own codeblock extension, but the issue affects the default highlighting codeblock as well.

This appears to be caused by the highlighting itself changing the browser's native selection.

The red 'x' selection causes the problem. Removing the syntax highlighting results in the selection with the green check and the issue resolves.

In these cases handleTextInput does not fire either.

image

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

Character should be inserted properly.

Anything to add? (optional)

This does not appear to affect Firefox

Did you update your dependencies?

Are you sponsoring us?

Nantris commented 1 year ago

Because handleTextInput doesn't fire I've pinged on the tangentially related ProseMirror issue: https://github.com/ProseMirror/prosemirror/issues/1307

Nantris commented 1 year ago

I've proposed a solution (at the ProseMirror level) here: https://github.com/ProseMirror/prosemirror/issues/1307#issuecomment-1661400598

Nantris commented 1 year ago

@bdbch do you have any thoughts on this one? I've identified a possible ProseMirror-level solution, but since I can't reproduce it in ProseMirror without TipTap, the odds of getting it fixed in ProseMirror are zero.

ProseMirror repro attempt where the issue does not occur: https://codesandbox.io/s/prosemirror-lee-forked-8rf8ys?file=/src/App.js