Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insertHtml Prepends Content #203

Open
vhmth opened this issue Nov 14, 2016 · 1 comment
Open

insertHtml Prepends Content #203

vhmth opened this issue Nov 14, 2016 · 1 comment

Comments

@vhmth
Copy link

vhmth commented Nov 14, 2016

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.

@vhmth
Copy link
Author

vhmth commented Nov 14, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant