src/edit/dompos.js
// Get a DOM element at a given position in the document.
Get a DOM element at a given position in the document.
Get a DOM element at a given position in the document .
function DOMFromPos(parent, pos) {
  let dom = childContainer(pathToDOM(parent, pos.path))
  let found = findByOffset(dom, pos.offset, true), inner
  if (!found) return {node: dom, offset: 0}
  if (found.node.getAttribute("pm-leaf") == "true" || !(inner = leafAt(found.node, found.innerOffset)))
    return {node: found.node.parentNode, offset: found.offset + (found.innerOffset ? 1 : 0)}
  else
    return inner
}
function DOMFromPos ( parent , pos ) { let dom = childContainer ( pathToDOM ( parent , pos . path ) ) let found = findByOffset ( dom , pos . offset , true ) , inner if ( ! found ) return { node : dom , offset : 0 } if ( found . node . getAttribute ( "pm-leaf" ) == "true" || ! ( inner = leafAt ( found . node , found . innerOffset ) ) ) return { node : found . node . parentNode , offset : found . offset + ( found . innerOffset ? 1 : 0 ) } else return inner }
Get a DOM element at a given position in the document.
Get a DOM element at a given position in the document .