Closed rjdellecese closed 3 years ago
Actually, it seems to work in Firefox, but not in Safari or Chrome.
I solved this by creating a new inline leaf node that is just an empty span containing a newline ("\n"
). Here is an updated Ellie with the solution. This worked for me in Chrome, Firefox, and Safari.
I wonder if it would be better to make RichText.Commands.insertNewline
work this way, too? If so, I would be happy to open a PR to do so!
I'll leave this open for the moment in case that would be useful, or else feel to close the issue—my particular problem has been solved.
That's cool that you solved your particular issue 👍 , it seems like different versions of contenteditable handle newline characters in pre elements in different ways. I don't know your exact requirements, but you may also be able to avoid the issue in a similar way line break element instead of using a newline wrapped in a span. I'll close this ticket for now. Thanks for reporting the issue!
See this Ellie. This issue is also observable in code blocks in the demo. I've injected a bunch of logging statements into the JS to try to understand what's going on, but haven't really made any headway. Any help would be much appreciated!