Use a span instead of image to prevent word-breaks #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes codemirror/dev#989
Currently the
<img>
tag used for thecm-WidgetBuffer
causes a word break. This is especially noticeable with collaborative cursors (i.e., from YJS and y-codemirror.next). The breaking behavior is weird. Joining with a⁠
in the text causes content changes in the contenteditable so this doesn't work reliably:This comment from @marijnh was insightful:
codemirror/dev#989 (comment)
It turns out there is such a mysterious element:
<nobr>
. It was never in a spec but was implemented. But it has been deprecated. Changing the buffer it a<nobr>
worked in Safari and Firefox (even with obscure CSS problems and no CSS) but didn't work in all cases with Chrome (3D transforms seemed to still break, which might not be important).The attached fix just uses a
<span style="white-space:nowrap">
and it works in all of the cases we want.In my application CSS I also have (not sure if it is required):