@atlaskit/editor-plugin-block-menu
Version:
BlockMenu plugin for @atlaskit/editor-core
33 lines (31 loc) • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isListWithTextContentOnly = exports.isListWithIndentation = void 0;
/**
* Checks if a node is a list type that supports indentation (bulletList, orderedList, taskList).
*
* @param node - The node to check.
* @param schema - ProseMirror schema for check
* @returns True if the node is a list type, false otherwise.
*/
var isListWithIndentation = exports.isListWithIndentation = function isListWithIndentation(nodeTypeName, schema) {
var lists = [schema.nodes.taskList, schema.nodes.bulletList, schema.nodes.orderedList];
return lists.some(function (list) {
return list.name === nodeTypeName;
});
};
/**
* Checks if a node is a list where its list items only support text content (taskList or decisionList).
*
* @param nodeTypeName - The node type name to check.
* @param schema - ProseMirror schema for check
* @returns True if the node is a list text type, false otherwise.
*/
var isListWithTextContentOnly = exports.isListWithTextContentOnly = function isListWithTextContentOnly(nodeTypeName, schema) {
var lists = [schema.nodes.taskList, schema.nodes.decisionList];
return lists.some(function (list) {
return list.name === nodeTypeName;
});
};