Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Created August 23, 2017 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barneycarroll/cbe78d7f4511090550dcd062f0bfaa2c to your computer and use it in GitHub Desktop.
Save barneycarroll/cbe78d7f4511090550dcd062f0bfaa2c to your computer and use it in GitHub Desktop.
Insert text pointer at expected location after injecting an element into contenteditable via external UI
dom.focus()
const range = document.createRange()
range.setStart(selection.anchorNode.nextSibling.nextSibling, 0)
range.collapse(true)
selection.removeAllRanges()
selection.addRange(range)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment