"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/header/index.ts var index_exports = {}; __export(index_exports, { TableHeader: () => TableHeader }); module.exports = __toCommonJS(index_exports); // src/header/table-header.ts var import_core = require("@tiptap/core"); // src/utilities/parseAlign.ts function normalizeTableCellAlign(value) { if (value === "left" /* Left */ || value === "right" /* Right */ || value === "center" /* Center */) { return value; } return null; } function parseAlign(element) { const styleAlign = (element.style.textAlign || "").trim().toLowerCase(); const attrAlign = (element.getAttribute("align") || "").trim().toLowerCase(); const align = styleAlign || attrAlign; return normalizeTableCellAlign(align); } function createAlignAttribute() { return { default: null, parseHTML: (element) => parseAlign(element), renderHTML: (attributes) => { if (!attributes.align) { return {}; } return { style: `text-align: ${attributes.align}` }; } }; } // src/header/table-header.ts var TableHeader = import_core.Node.create({ name: "tableHeader", addOptions() { return { HTMLAttributes: {} }; }, content: "block+", addAttributes() { return { colspan: { default: 1 }, rowspan: { default: 1 }, colwidth: { default: null, parseHTML: (element) => { const colwidth = element.getAttribute("colwidth"); const value = colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null; return value; } }, align: createAlignAttribute() }; }, tableRole: "header_cell", isolating: true, parseHTML() { return [{ tag: "th" }]; }, renderHTML({ HTMLAttributes }) { return ["th", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; } }); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { TableHeader }); //# sourceMappingURL=index.cjs.map