export const isMarkAllowedInRange = (doc, ranges, type) => {
  for (let i = 0; i < ranges.length; i++) {
    const {
      $from,
      $to
    } = ranges[i];
    let can = $from.depth === 0 ? doc.type.allowsMarkType(type) : false;
    doc.nodesBetween($from.pos, $to.pos, node => {
      if (can) {
        return false;
      }
      can = node.inlineContent && node.type.allowsMarkType(type);
      return;
    });
    if (can) {
      return can;
    }
  }
  return false;
};