insertHtml Prepends Content
vhmth opened this issue · comments
I noticed that when I try to insertHtml('<ul><li></li></ul>');
to a Medium.js
instance after calling medium.focus()
off a button click, the content is always prepended. Not sure what's exactly going on, but I figured it may be because calling medium.focus()
results in the cursor unconditionally going to the beginning of the text area.
I've made a video showcasing what's going on here:
https://www.opentest.co/share/c509f0d0aabe11e69e53f587dba00be5
I would be happy to open a PR to get this fixed ASAP if someone has an inkling of suspicion as to what may be going on here. The example on the GH page seems to work fine for me so perhaps it's some nuance of my local setup? I am including rangy
(both core
and the other sub lib) as well as undo.js
.
Upon a bit more investigation, it seems like span#wedge
element gets placed at the start of my content div
in Medium.Injector.prototype.inject
when this.insertHtml
is called. Strange because that will then make parent.insertBefore(html[i], wedge);
insert the list at the beginning.