I have a markdown text
**hello `world`** 123
Rendered as:
With their positions as
Now I insert some text right on the right-side of world
at position ‘12’ as indicated above:
tr.insertText("foo", 12);
The ‘foo’ ends up inside the <code />
tag:
But I wanted the ‘foo’ to be adjacent to world
but not inside its code
tag. I can get that result if I insert like this:
tr.insertText("foo", 12, 13);
But that removes the existing whitespace between world
and ‘123’:
Which led me to insert like this…
tr.insertText("foo ", 12, 13); // foo with a whitespace, duh
There is no such issue when I insert like this tr.insertText("foo", 12)
and the last child only has one mark. For example, ‘nice’ is the last child and it only has one mark which is ‘strong’:
**hello `world`nice** 123
, and the result will be
hello world
nicefoo 123
Which is what I wanted.