"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/item/index.ts var index_exports = {}; __export(index_exports, { ListItem: () => ListItem }); module.exports = __toCommonJS(index_exports); // src/item/list-item.ts var import_core = require("@tiptap/core"); var ListItem = import_core.Node.create({ name: "listItem", addOptions() { return { HTMLAttributes: {}, bulletListTypeName: "bulletList", orderedListTypeName: "orderedList" }; }, content: "paragraph block*", defining: true, parseHTML() { return [ { tag: "li" } ]; }, renderHTML({ HTMLAttributes }) { return ["li", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; }, markdownTokenName: "list_item", parseMarkdown: (token, helpers) => { var _a; if (token.type !== "list_item") { return []; } const parseBlockChildren = (_a = helpers.parseBlockChildren) != null ? _a : helpers.parseChildren; let content = []; if (token.tokens && token.tokens.length > 0) { const hasParagraphTokens = token.tokens.some((t) => t.type === "paragraph"); if (hasParagraphTokens) { content = parseBlockChildren(token.tokens); } else { const firstToken = token.tokens[0]; if (firstToken && firstToken.type === "text" && firstToken.tokens && firstToken.tokens.length > 0) { const inlineContent = helpers.parseInline(firstToken.tokens); content = [ { type: "paragraph", content: inlineContent } ]; if (token.tokens.length > 1) { const remainingTokens = token.tokens.slice(1); const additionalContent = parseBlockChildren(remainingTokens); content.push(...additionalContent); } } else { content = parseBlockChildren(token.tokens); } } } if (content.length === 0) { content = [ { type: "paragraph", content: [] } ]; } return { type: "listItem", content }; }, renderMarkdown: (node, h, ctx) => { return (0, import_core.renderNestedMarkdownContent)( node, h, (context) => { var _a, _b; if (context.parentType === "bulletList") { return "- "; } if (context.parentType === "orderedList") { const start = ((_b = (_a = context.meta) == null ? void 0 : _a.parentAttrs) == null ? void 0 : _b.start) || 1; return `${start + context.index}. `; } return "- "; }, ctx ); }, addKeyboardShortcuts() { return { Enter: () => this.editor.commands.splitListItem(this.name), Tab: () => this.editor.commands.sinkListItem(this.name), "Shift-Tab": () => this.editor.commands.liftListItem(this.name) }; } }); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ListItem }); //# sourceMappingURL=index.cjs.map