code: function canSplit(doc, pos, depth = 1, typesAfter) {
    const $pos = doc.resolve(pos); const
  base = $pos.depth - depth
    const innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent
    if (base < 0 || $pos.parent.type.spec.isolating
        || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount)
        || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false
    for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
      const node = $pos.node(d); const
  index = $pos.index(d)
      if (node.type.spec.isolating) return false
      let rest = node.content.cutByIndex(index, node.childCount)
      const after = (typesAfter && typesAfter[i]) || node
      if (after != node) rest = rest.replaceChild(0, after.type.create(after.attrs))
  
      /* Change starts from here */
      // if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))
      //   return false
      if (!node.canReplace(index + 1, node.childCount)) return false
      /* Change ends here */
    }
    const index = $pos.indexAfter(base)
    const baseType = typesAfter && typesAfter[0]
    return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type)
  }
docs: Since this piece of code was "borrowed" from prosemirror, ESLint rules are ignored. /* eslint-disable max-len, no-plusplus, no-undef, eqeqeq