UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

23 lines (22 loc) 821 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasValidListIndentationLevel = void 0; var _selection = require("./selection"); var hasValidListIndentationLevel = exports.hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) { var tr = _ref.tr, maxIndentation = _ref.maxIndentation; var initialIndentationLevel = (0, _selection.numberNestedLists)(tr.selection.$from); var currentIndentationLevel; var currentPos = tr.selection.$to.pos; do { var resolvedPos = tr.doc.resolve(currentPos); currentIndentationLevel = (0, _selection.numberNestedLists)(resolvedPos); if (currentIndentationLevel > maxIndentation) { return false; } currentPos++; } while (currentIndentationLevel >= initialIndentationLevel); return true; };