src/model/fragment.js
// all the way to the start or end of the fragment.
all the way to the start or end of the fragment.
all the way to the start or end of the fragment .
sliceBetween(from, to, depth = 0) {
    let moreFrom = from && from.depth > depth, moreTo = to && to.depth > depth
    let start = moreFrom ? from.path[depth] : from ? from.offset : 0
    let end = moreTo ? to.path[depth] + 1 : to ? to.offset : this.size
    let nodes = []
    for (let iter = this.iter(start, end), node; node = iter.next().value;) {
      let passFrom = moreFrom && (iter.offset - node.width) == start ? from : null
      let passTo = moreTo && iter.offset == end ? to : null
      if (passFrom || passTo)
        node = node.sliceBetween(passFrom, passTo, depth + 1)
      nodes.push(node)
    }
    return new this.constructor(nodes)
  }
sliceBetween ( from , to , depth = 0 ) { let moreFrom = from && from . depth > depth , moreTo = to && to . depth > depth let start = moreFrom ? from . path [ depth ] : from ? from . offset : 0 let end = moreTo ? to . path [ depth ] + 1 : to ? to . offset : this . size let nodes = [ ] for ( let iter = this . iter ( start , end ) , node ; node = iter . next ( ) . value ; ) { let passFrom = moreFrom && ( iter . offset - node . width ) == start ? from : null let passTo = moreTo && iter . offset == end ? to : null if ( passFrom || passTo ) node = node . sliceBetween ( passFrom , passTo , depth + 1 ) nodes . push ( node ) } return new this . constructor ( nodes ) }
all the way to the start or end of the fragment.
all the way to the start or end of the fragment .