export const setEndOfContenteditable = (
  editingElement: Element,
  el: any,
  pos?: number | undefined
) => {
  const selection = window.getSelection()
  const range = document.createRange()
  selection.removeAllRanges()
  if (pos) {
    range.setStart(editingElement.childNodes[0], pos)
  } else {
    range.selectNodeContents(el)
    range.collapse(false)
  }
  selection.addRange(range)
}
