Closed mjp0 closed 2 months ago
It happens when you create a few bullet points, then hit enter to get another, hit space, and then move to the bullet point above. This creates - , and I can't move to that bullet point anymore until I remove .
Can you record a video of this happening? Seems to be working well in the demo.
It happens when you create a few bullet points, then hit enter to get another, hit space, and then move to the bullet point above. This creates - , and I can't move to that bullet point anymore until I remove .
Can you record a video of this happening? Seems to be working well in the demo.
Sure. When the cursor jumps to the beginning of the line, behind the bullet, that's the point where I hit space and  
is created.
edit Yeah, it seems to be working in the demo. I wonder why mine is doing that. I don't have any custom plugins or anything like that. I don't even mess with the content itself, I only save from the onChange and the editor manages its own state.
https://github.com/user-attachments/assets/370f794b-6bd5-45a4-8698-b0a11d7d8731
Is this reproducible here: https://mdxeditor.dev/editor/demo
edit Yeah, it seems to be working in the demo. I wonder why mine is doing that. I don't have any custom plugins or anything like that. I don't even mess with the content itself, I only save from the onChange and the editor manages its own state.
Is the editor demo source available somewhere? I'd like to compare the config.
I don't know what can cause this. I've seen similar glitches in Lexical, sometimes the cursor goes at an invalid location, but not with the lists (usually, it's with horizontal ruels).
I couldn't find the root cause for this but I introduced a sort of "auto-healing" when this happens by adding a debounced find/replace function on onChange that replaces -  
with -
using get/setMarkdown()
after a few seconds to make sure user has stopped writing. It's not pretty and it's janky because cursor jumps to the start of the doc but at least the list isn't broken anymore from the user's point of view.
I don't think the problem is related to those characters. They are just serializations of whitespace necessary for it to be preserved in markdown, otherwise it will be lost. Something does not work well in the Lexical runtime, but I can't say what. If you can compare your setup with the one I posted, you should be able to find the root cause.
Encountering the same problem as @mjp0 mentioned. Since I don't like the jumping after a get/setMarkdown
, I wanted to try to sanitize the markdown when the editor changes via diffSourcePlugin
to diff or source mode. Sadly there doesn't seem to be a way to overwrite what is used for the modes since it just assumes the markdown as the truth (which technically is correct I guess).
Describe the bug When I'm in rich text mode, the editor creates HTML codes like
	
and 
that completely mess up the usability. For example, if the editor generates-  
, I can't move to that bullet point anymore. The user has to manually switch to source mode and remove these.I've tried to fix this by replacing those HTML codes with
onChange
and theneditor.setMarkdown()
, but that breaks other functionality, like nested bullet points. Since I can't replace them on the fly, I don't know what else to try.Reproduction It happens when you create a few bullet points, then hit enter to get another, hit space, and then move to the bullet point above. This creates
-  
, and I can't move to that bullet point anymore until I remove 
.Expected behavior It should not break.
Screenshots
Desktop (please complete the following information):