"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.entireSelectionContainsMark = void 0;
var entireSelectionContainsMark = exports.entireSelectionContainsMark = function entireSelectionContainsMark(mark, doc, fromPos, toPos) {
  var onlyContainsMark = true;
  doc.nodesBetween(fromPos, toPos, function (node) {
    // Skip recursion once we've found text which doesn't include the mark
    if (!onlyContainsMark) {
      return false;
    }
    if (node.isText) {
      onlyContainsMark && (onlyContainsMark = !!(mark !== null && mark !== void 0 && mark.isInSet(node.marks)));
    }
  });
  return onlyContainsMark;
};