{"version":3,"file":"index.cjs","names":["CellSelection","findParentNodeClosestToPos","findParentNodeClosestToPos","TextSelection","PluginKey","Plugin","Node","mergeAttributes","TextSelection","addColumnBefore","addColumnAfter","findParentNodeClosestToPos","deleteColumn","addRowBefore","addRowAfter","deleteRow","deleteTable","mergeCells","splitCell","toggleHeader","toggleHeaderCell","setCellAttr","goToNextCell","CellSelection","columnResizing","tableEditing","callOrReturn","getExtensionField"],"sources":["../../src/utils/parseAlign.ts","../../src/table/utilities/colStyle.ts","../../src/table/TableView.ts","../../src/table/utilities/createColGroup.ts","../../src/table/utilities/createCell.ts","../../src/table/utilities/getTableNodeTypes.ts","../../src/table/utilities/createTable.ts","../../src/table/utilities/isCellSelection.ts","../../src/table/utilities/deleteTableWhenAllCellsSelected.ts","../../src/table/utilities/keepCursorInTable.ts","../../src/table/utilities/markdown.ts","../../src/table/utilities/preserveCellSelectionOnContextMenu.ts","../../src/table/table.ts"],"sourcesContent":["import { type Attribute, isValidCSSStyleValue } from '@tiptap/core'\n\n/**\n * Supported table cell alignment values\n */\nexport enum TableCellAlign {\n  Left = 'left',\n  Right = 'right',\n  Center = 'center',\n}\n\n/**\n * Normalize unknown input into a supported table alignment\n *\n * @param value - A potential alignment value\n * @returns A valid TableCellAlign value or null\n */\nexport function normalizeTableCellAlign(value: unknown): TableCellAlign | null {\n  if (\n    value === TableCellAlign.Left ||\n    value === TableCellAlign.Right ||\n    value === TableCellAlign.Center\n  ) {\n    return value\n  }\n\n  return null\n}\n\n/**\n * Parse table cell alignment from an HTML element\n *\n * Prefers inline style (${\"`\"}text-align${\"`\"}) and falls back to the legacy\n * ${\"`\"}align${\"`\"} attribute.\n *\n * @param element - The table cell/header DOM element\n * @returns A valid TableCellAlign value or null\n */\nfunction parseAlign(element: HTMLElement): TableCellAlign | null {\n  const styleAlign = (element.style.textAlign || '').trim().toLowerCase()\n  const attrAlign = (element.getAttribute('align') || '').trim().toLowerCase()\n  const align = styleAlign || attrAlign\n\n  return normalizeTableCellAlign(align)\n}\n\n/**\n * Normalize alignment from a generic attrs object that may include an align field\n *\n * @param attributes - A node attrs-like object with an optional align field\n * @returns A valid TableCellAlign value or null.\n */\nexport function normalizeTableCellAlignFromAttributes(\n  attributes: { align?: TableCellAlign } | null | undefined,\n): TableCellAlign | null {\n  return normalizeTableCellAlign(attributes?.align)\n}\n\n/**\n * Create a reusable Tiptap attribute config for table alignment\n *\n * @returns A Tiptap Attribute definition that parses and renders table alignment\n */\nexport function createAlignAttribute(): Attribute {\n  return {\n    default: null,\n    parseHTML: (element: HTMLElement) => parseAlign(element),\n    renderHTML: (attributes: { align?: unknown }) => {\n      const align = normalizeTableCellAlign(attributes.align)\n\n      if (!isValidCSSStyleValue(align)) {\n        return {}\n      }\n\n      return {\n        style: `text-align: ${align}`,\n      }\n    },\n  }\n}\n","export function getColStyleDeclaration(\n  minWidth: number,\n  width: number | undefined,\n): [string, string] {\n  if (width) {\n    // apply the stored width unless it is below the configured minimum cell width\n    return ['width', `${Math.max(width, minWidth)}px`]\n  }\n\n  // set the minimum with on the column if it has no stored width\n  return ['min-width', `${minWidth}px`]\n}\n","import type { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport type { EditorView, NodeView, ViewMutationRecord } from '@tiptap/pm/view'\n\nimport { getColStyleDeclaration } from './utilities/colStyle.js'\n\nexport function updateColumns(\n  node: ProseMirrorNode,\n  colgroup: HTMLTableColElement, // <colgroup> has the same prototype as <col>\n  table: HTMLTableElement,\n  cellMinWidth: number,\n  overrideCol?: number,\n  overrideValue?: number,\n) {\n  let totalWidth = 0\n  let fixedWidth = true\n  let nextDOM = colgroup.firstChild\n  const row = node.firstChild\n\n  if (row !== null) {\n    for (let i = 0, col = 0; i < row.childCount; i += 1) {\n      const { colspan, colwidth } = row.child(i).attrs\n\n      for (let j = 0; j < colspan; j += 1, col += 1) {\n        const hasWidth =\n          overrideCol === col ? overrideValue : ((colwidth && colwidth[j]) as number | undefined)\n        const cssWidth = hasWidth ? `${hasWidth}px` : ''\n\n        totalWidth += hasWidth || cellMinWidth\n\n        if (!hasWidth) {\n          fixedWidth = false\n        }\n\n        if (!nextDOM) {\n          const colElement = document.createElement('col')\n\n          const [propertyKey, propertyValue] = getColStyleDeclaration(cellMinWidth, hasWidth)\n\n          colElement.style.setProperty(propertyKey, propertyValue)\n\n          colgroup.appendChild(colElement)\n        } else {\n          if ((nextDOM as HTMLTableColElement).style.width !== cssWidth) {\n            const [propertyKey, propertyValue] = getColStyleDeclaration(cellMinWidth, hasWidth)\n\n            ;(nextDOM as HTMLTableColElement).style.setProperty(propertyKey, propertyValue)\n          }\n\n          nextDOM = nextDOM.nextSibling\n        }\n      }\n    }\n  }\n\n  while (nextDOM) {\n    const after = nextDOM.nextSibling\n\n    nextDOM.parentNode?.removeChild(nextDOM)\n    nextDOM = after\n  }\n\n  // Check if user has set a width style on the table node\n  const hasUserWidth =\n    node.attrs.style &&\n    typeof node.attrs.style === 'string' &&\n    /\\bwidth\\s*:/i.test(node.attrs.style)\n\n  if (fixedWidth && !hasUserWidth) {\n    table.style.width = `${totalWidth}px`\n    table.style.minWidth = ''\n  } else {\n    table.style.width = ''\n    table.style.minWidth = `${totalWidth}px`\n  }\n}\n\nexport class TableView implements NodeView {\n  node: ProseMirrorNode\n\n  cellMinWidth: number\n\n  dom: HTMLDivElement\n\n  table: HTMLTableElement\n\n  colgroup: HTMLTableColElement\n\n  contentDOM: HTMLTableSectionElement\n\n  constructor(\n    node: ProseMirrorNode,\n    cellMinWidth: number,\n    _view?: EditorView,\n    HTMLAttributes: Record<string, any> = {},\n  ) {\n    this.node = node\n    this.cellMinWidth = cellMinWidth\n    this.dom = document.createElement('div')\n    this.dom.className = 'tableWrapper'\n    this.table = this.dom.appendChild(document.createElement('table'))\n\n    // Apply extension-configured HTMLAttributes to the table element\n    // (e.g. class, data-* set via Table.configure({ HTMLAttributes }))\n    for (const [key, value] of Object.entries(HTMLAttributes)) {\n      if (value !== undefined && value !== null) {\n        if (key === 'style') {\n          this.table.style.cssText = String(value)\n        } else {\n          this.table.setAttribute(key, String(value))\n        }\n      }\n    }\n\n    // Apply user styles from the ProseMirror document node.\n    // This may come from HTML parsing (e.g. <table style=\"...\">) and should\n    // override any style set via extension-configured HTMLAttributes above.\n    if (node.attrs.style) {\n      this.table.style.cssText = node.attrs.style\n    }\n\n    this.colgroup = this.table.appendChild(document.createElement('colgroup'))\n    updateColumns(node, this.colgroup, this.table, cellMinWidth)\n    this.contentDOM = this.table.appendChild(document.createElement('tbody'))\n  }\n\n  update(node: ProseMirrorNode) {\n    // Recreate the view to apply changed table attributes.\n    if (!node.sameMarkup(this.node)) {\n      return false\n    }\n\n    this.node = node\n    updateColumns(node, this.colgroup, this.table, this.cellMinWidth)\n\n    return true\n  }\n\n  ignoreMutation(mutation: ViewMutationRecord) {\n    const target = mutation.target as Node\n    const isInsideWrapper = this.dom.contains(target)\n    const isInsideContent = this.contentDOM.contains(target)\n\n    if (isInsideWrapper && !isInsideContent) {\n      if (\n        mutation.type === 'attributes' ||\n        mutation.type === 'childList' ||\n        mutation.type === 'characterData'\n      ) {\n        return true\n      }\n    }\n\n    return false\n  }\n}\n","import type { DOMOutputSpec, Node as ProseMirrorNode } from '@tiptap/pm/model'\n\nimport { getColStyleDeclaration } from './colStyle.js'\n\nexport type ColGroup =\n  | {\n      colgroup: DOMOutputSpec\n      tableWidth: string\n      tableMinWidth: string\n    }\n  | Record<string, never>\n\n/**\n * Creates a colgroup element for a table node in ProseMirror.\n *\n * @param node - The ProseMirror node representing the table.\n * @param cellMinWidth - The minimum width of a cell in the table.\n * @param overrideCol - (Optional) The index of the column to override the width of.\n * @param overrideValue - (Optional) The width value to use for the overridden column.\n * @returns An object containing the colgroup element, the total width of the table, and the minimum width of the table.\n */\nexport function createColGroup(node: ProseMirrorNode, cellMinWidth: number): ColGroup\nexport function createColGroup(\n  node: ProseMirrorNode,\n  cellMinWidth: number,\n  overrideCol: number,\n  overrideValue: number,\n): ColGroup\nexport function createColGroup(\n  node: ProseMirrorNode,\n  cellMinWidth: number,\n  overrideCol?: number,\n  overrideValue?: number,\n): ColGroup {\n  let totalWidth = 0\n  let fixedWidth = true\n  const cols: DOMOutputSpec[] = []\n  const row = node.firstChild\n\n  if (!row) {\n    return {}\n  }\n\n  for (let i = 0, col = 0; i < row.childCount; i += 1) {\n    const { colspan, colwidth } = row.child(i).attrs\n\n    for (let j = 0; j < colspan; j += 1, col += 1) {\n      const hasWidth =\n        overrideCol === col ? overrideValue : colwidth && (colwidth[j] as number | undefined)\n\n      totalWidth += hasWidth || cellMinWidth\n\n      if (!hasWidth) {\n        fixedWidth = false\n      }\n\n      const [property, value] = getColStyleDeclaration(cellMinWidth, hasWidth)\n\n      cols.push(['col', { style: `${property}: ${value}` }])\n    }\n  }\n\n  const tableWidth = fixedWidth ? `${totalWidth}px` : ''\n  const tableMinWidth = fixedWidth ? '' : `${totalWidth}px`\n\n  const colgroup: DOMOutputSpec = ['colgroup', {}, ...cols]\n\n  return { colgroup, tableWidth, tableMinWidth }\n}\n","import type { Fragment, Node as ProsemirrorNode, NodeType } from '@tiptap/pm/model'\n\nexport function createCell(\n  cellType: NodeType,\n  cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>,\n): ProsemirrorNode | null | undefined {\n  if (cellContent) {\n    return cellType.createChecked(null, cellContent)\n  }\n\n  return cellType.createAndFill()\n}\n","import type { NodeType, Schema } from '@tiptap/pm/model'\n\nexport function getTableNodeTypes(schema: Schema): { [key: string]: NodeType } {\n  if (schema.cached.tableNodeTypes) {\n    return schema.cached.tableNodeTypes\n  }\n\n  const roles: { [key: string]: NodeType } = {}\n\n  Object.keys(schema.nodes).forEach(type => {\n    const nodeType = schema.nodes[type]\n\n    if (nodeType.spec.tableRole) {\n      roles[nodeType.spec.tableRole] = nodeType\n    }\n  })\n\n  schema.cached.tableNodeTypes = roles\n\n  return roles\n}\n","import type { Fragment, Node as ProsemirrorNode, Schema } from '@tiptap/pm/model'\n\nimport { createCell } from './createCell.js'\nimport { getTableNodeTypes } from './getTableNodeTypes.js'\n\nexport function createTable(\n  schema: Schema,\n  rowsCount: number,\n  colsCount: number,\n  withHeaderRow: boolean,\n  cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>,\n): ProsemirrorNode {\n  const types = getTableNodeTypes(schema)\n  const headerCells: ProsemirrorNode[] = []\n  const cells: ProsemirrorNode[] = []\n\n  for (let index = 0; index < colsCount; index += 1) {\n    const cell = createCell(types.cell, cellContent)\n\n    if (cell) {\n      cells.push(cell)\n    }\n\n    if (withHeaderRow) {\n      const headerCell = createCell(types.header_cell, cellContent)\n\n      if (headerCell) {\n        headerCells.push(headerCell)\n      }\n    }\n  }\n\n  const rows: ProsemirrorNode[] = []\n\n  for (let index = 0; index < rowsCount; index += 1) {\n    rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells))\n  }\n\n  return types.table.createChecked(null, rows)\n}\n","import { CellSelection } from '@tiptap/pm/tables'\n\nexport function isCellSelection(value: unknown): value is CellSelection {\n  return value instanceof CellSelection\n}\n","import type { KeyboardShortcutCommand } from '@tiptap/core'\nimport { findParentNodeClosestToPos } from '@tiptap/core'\n\nimport { isCellSelection } from './isCellSelection.js'\n\nexport const deleteTableWhenAllCellsSelected: KeyboardShortcutCommand = ({ editor }) => {\n  const { selection } = editor.state\n\n  if (!isCellSelection(selection)) {\n    return false\n  }\n\n  let cellCount = 0\n  const table = findParentNodeClosestToPos(selection.ranges[0].$from, node => {\n    return node.type.name === 'table'\n  })\n\n  table?.node.descendants(node => {\n    if (node.type.name === 'table') {\n      return false\n    }\n\n    if (['tableCell', 'tableHeader'].includes(node.type.name)) {\n      cellCount += 1\n    }\n  })\n\n  const allCellsSelected = cellCount === selection.ranges.length\n\n  if (!allCellsSelected) {\n    return false\n  }\n\n  editor.commands.deleteTable()\n\n  return true\n}\n","import { findParentNodeClosestToPos } from '@tiptap/core'\nimport { TextSelection, type Transaction } from '@tiptap/pm/state'\n\n// prosemirror-tables does not move the selection after a deletion, so removing the\n// last row or column can push the cursor out of the table into the content below.\nexport function keepCursorInTable(tr: Transaction, tablePos: number) {\n  const mappedTablePos = tr.mapping.map(tablePos)\n\n  // The delete can push the cursor into a following table, so compare the\n  // mapped position to confirm it is still the table we edited.\n  const stillInTable = findParentNodeClosestToPos(\n    tr.selection.$from,\n    node => node.type.name === 'table',\n  )\n\n  if (stillInTable?.pos === mappedTablePos) {\n    return\n  }\n\n  const tableNode = tr.doc.nodeAt(mappedTablePos)\n\n  if (!tableNode) {\n    return\n  }\n\n  const endOfTable = mappedTablePos + tableNode.nodeSize - 1\n\n  tr.setSelection(TextSelection.near(tr.doc.resolve(endOfTable), -1))\n}\n","import type { JSONContent, MarkdownRendererHelpers } from '@tiptap/core'\n\nimport {\n  type TableCellAlign as TableCellAlignType,\n  normalizeTableCellAlignFromAttributes,\n  TableCellAlign,\n} from '../../utils/parseAlign.js'\n\nexport const DEFAULT_CELL_LINE_SEPARATOR = '\\u001F'\n\n/**\n * Walk a single table-row line and escape any `|` characters that appear\n * inside backtick code spans so marked's cell splitter ignores them.\n * Backslash escape sequences outside code spans are passed through untouched.\n * If a backtick run has no matching closer on the same line it is emitted\n * as-is — no over-escaping for malformed input.\n */\nexport function escapeTableCellPipes(line: string): string {\n  let result = ''\n  let i = 0\n  while (i < line.length) {\n    if (line[i] === '\\\\' && i + 1 < line.length) {\n      result += line[i] + line[i + 1]\n      i += 2\n      continue\n    }\n    if (line[i] !== '`') {\n      result += line[i++]\n      continue\n    }\n    let runLen = 0\n    while (i + runLen < line.length && line[i + runLen] === '`') runLen += 1\n    let j = i + runLen\n    let found = false\n    while (j < line.length) {\n      if (line[j] !== '`') {\n        j += 1\n        continue\n      }\n      let closeLen = 0\n      while (j + closeLen < line.length && line[j + closeLen] === '`') closeLen += 1\n      if (closeLen === runLen) {\n        const spanContent = line.slice(i + runLen, j)\n        // Matches an already-escaped pipe (`\\|`, kept as-is) or a bare pipe\n        // (escaped). Deliberately avoids a negative lookbehind assertion:\n        // WebKit before Safari 16.4 cannot parse lookbehind, and a regex\n        // literal fails the whole chunk at parse time, not at call time.\n        result +=\n          line.slice(i, i + runLen) +\n          spanContent.replace(/\\\\\\||\\|/g, match => (match === '|' ? '\\\\|' : match)) +\n          line.slice(j, j + runLen)\n        i = j + runLen\n        found = true\n        break\n      }\n      j += closeLen\n    }\n    if (!found) {\n      result += line.slice(i, i + runLen)\n      i += runLen\n    }\n  }\n  return result\n}\n\n/**\n * Escape pipe characters inside backtick code spans on table-row lines.\n * marked's `splitCells` only recognises backslash-escaped pipes (`\\|`) and\n * splits on every other `|`, so \\`a || b\\` in a table cell would be treated\n * as multiple column delimiters. Escaping them here lets `splitCells` skip\n * them; it already converts `\\|` → `|` after splitting, so the cell content\n * is restored correctly.\n */\nexport function preprocessTablePipes(src: string): string {\n  return src\n    .split('\\n')\n    .map(line => {\n      if (!line.includes('|') || !line.includes('`')) return line\n      return escapeTableCellPipes(line)\n    })\n    .join('\\n')\n}\n\nfunction collapseWhitespace(s: string) {\n  return (s || '').replaceAll(DEFAULT_CELL_LINE_SEPARATOR, ' ').replace(/\\s+/g, ' ').trim()\n}\n\nfunction replaceCellLineSeparator(value: string, cellLineSeparator?: string) {\n  if (!cellLineSeparator) {\n    return value\n  }\n\n  return value.split(cellLineSeparator).join('\\n')\n}\n\nfunction escapePipesInCellText(text: string) {\n  // Keep already escaped pipes as they are\n  return text.replace(/\\\\.|\\|/g, match => (match === '|' ? '\\\\|' : match))\n}\n\nexport function renderTableToMarkdown(\n  node: JSONContent,\n  h: MarkdownRendererHelpers,\n  options: { cellLineSeparator?: string } = {},\n) {\n  if (!node || !node.content || node.content.length === 0) {\n    return ''\n  }\n\n  // Build rows: each cell is { text, isHeader, align }\n  const rows: { text: string; isHeader: boolean; align: TableCellAlignType | null }[][] = []\n\n  node.content.forEach(rowNode => {\n    const cells: { text: string; isHeader: boolean; align: TableCellAlignType | null }[] = []\n\n    if (rowNode.content) {\n      rowNode.content.forEach(cellNode => {\n        let raw = ''\n\n        if (cellNode.content && Array.isArray(cellNode.content) && cellNode.content.length > 1) {\n          const parts = cellNode.content.map(child =>\n            replaceCellLineSeparator(\n              h.renderChildren(child as unknown as JSONContent),\n              options.cellLineSeparator,\n            ),\n          )\n          raw = parts.join('\\n')\n        } else {\n          raw = replaceCellLineSeparator(\n            cellNode.content ? h.renderChildren(cellNode.content as unknown as JSONContent[]) : '',\n            options.cellLineSeparator,\n          )\n        }\n\n        // Cells have to stay on a single line, so line breaks become <br> tags.\n        // The parser already turns <br> back into hard breaks, so this round trips.\n        const singleLine = collapseWhitespace(raw.replace(/[ \\t]*\\r?\\n[ \\t]*/g, '<br>'))\n        const text = escapePipesInCellText(singleLine)\n        const isHeader = cellNode.type === 'tableHeader'\n        const align = normalizeTableCellAlignFromAttributes(cellNode.attrs)\n\n        cells.push({ text, isHeader, align })\n      })\n    }\n\n    rows.push(cells)\n  })\n\n  const columnCount = rows.reduce((max, r) => Math.max(max, r.length), 0)\n\n  if (columnCount === 0) {\n    return ''\n  }\n\n  // Compute max width for each column\n  const colWidths = Array.from<number>({ length: columnCount }).fill(0)\n\n  rows.forEach(r => {\n    for (let i = 0; i < columnCount; i += 1) {\n      const cell = r[i]?.text || ''\n      const len = cell.length\n      if (len > colWidths[i]) {\n        colWidths[i] = len\n      }\n\n      if (colWidths[i] < 3) {\n        colWidths[i] = 3\n      }\n    }\n  })\n\n  const pad = (s: string, width: number) => s + ' '.repeat(Math.max(0, width - s.length))\n\n  const headerRow = rows[0]\n  const hasHeader = headerRow.some(c => c.isHeader)\n  const colAlignments: Array<TableCellAlignType | null> = Array.from<TableCellAlignType | null>({\n    length: columnCount,\n  }).fill(null)\n\n  rows.forEach(r => {\n    for (let i = 0; i < columnCount; i += 1) {\n      if (!colAlignments[i] && r[i]?.align) {\n        colAlignments[i] = r[i].align\n      }\n    }\n  })\n\n  let out = '\\n'\n\n  // Render header: if the document has a header row (tableHeader cells) use it,\n  // otherwise emit an empty header row so most Markdown parsers will recognize\n  // the table (this makes roundtripping to Markdown -> JSON more reliable).\n  const headerTexts = Array.from<number>({ length: columnCount }).map((_, i) =>\n    hasHeader ? (headerRow[i] && headerRow[i].text) || '' : '',\n  )\n\n  out += `| ${headerTexts.map((t, i) => pad(t, colWidths[i])).join(' | ')} |\\n`\n\n  // Separator (use at least 3 dashes per column and include alignment markers)\n  out += `| ${colWidths\n    .map((w, index) => {\n      const dashCount = Math.max(3, w)\n      const alignment = colAlignments[index]\n\n      if (alignment === TableCellAlign.Left) {\n        return `:${'-'.repeat(dashCount)}`\n      }\n\n      if (alignment === TableCellAlign.Right) {\n        return `${'-'.repeat(dashCount)}:`\n      }\n\n      if (alignment === TableCellAlign.Center) {\n        return `:${'-'.repeat(dashCount)}:`\n      }\n\n      return '-'.repeat(dashCount)\n    })\n    .join(' | ')} |\\n`\n\n  // Body rows: if we had a header, skip the first row; otherwise render all rows\n  const body = hasHeader ? rows.slice(1) : rows\n  body.forEach(r => {\n    out += `| ${Array.from<number>({ length: columnCount })\n      .fill(0)\n      .map((_, i) => pad((r[i] && r[i].text) || '', colWidths[i]))\n      .join(' | ')} |\\n`\n  })\n\n  return out\n}\n\nexport default renderTableToMarkdown\n","import { Plugin, PluginKey } from '@tiptap/pm/state'\nimport type { CellSelection } from '@tiptap/pm/tables'\nimport type { EditorView } from '@tiptap/pm/view'\n\nimport { isCellSelection } from './isCellSelection.js'\n\nconst preserveCellSelectionOnContextMenuPluginKey = new PluginKey(\n  'preserveCellSelectionOnContextMenu',\n)\n\nfunction resolveClickPos(view: EditorView, event: MouseEvent): number | null {\n  const coords = view.posAtCoords({ left: event.clientX, top: event.clientY })\n\n  if (coords) {\n    return coords.pos\n  }\n\n  if (!(event.target instanceof Node)) {\n    return null\n  }\n\n  try {\n    return view.posAtDOM(event.target, 0)\n  } catch {\n    return null\n  }\n}\n\nfunction isPosInsideCellSelection(selection: CellSelection, pos: number): boolean {\n  let inside = false\n\n  selection.forEachCell((cell, cellPos) => {\n    if (pos >= cellPos && pos < cellPos + cell.nodeSize) {\n      inside = true\n    }\n  })\n\n  return inside\n}\n\nexport function preserveCellSelectionOnContextMenu() {\n  return new Plugin({\n    key: preserveCellSelectionOnContextMenuPluginKey,\n    props: {\n      handleDOMEvents: {\n        mousedown(view, event) {\n          if (event.button !== 2) {\n            return false\n          }\n\n          const { selection } = view.state\n\n          if (!isCellSelection(selection) || selection.ranges.length < 2) {\n            return false\n          }\n\n          const clickPos = resolveClickPos(view, event)\n\n          if (clickPos == null || !isPosInsideCellSelection(selection, clickPos)) {\n            return false\n          }\n\n          event.preventDefault()\n          return true\n        },\n      },\n    },\n  })\n}\n","import '../types.js'\n\nimport {\n  type JSONContent,\n  type MarkdownToken,\n  callOrReturn,\n  findParentNodeClosestToPos,\n  getExtensionField,\n  mergeAttributes,\n  Node,\n} from '@tiptap/core'\nimport type { DOMOutputSpec, Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { TextSelection } from '@tiptap/pm/state'\nimport {\n  addColumnAfter,\n  addColumnBefore,\n  addRowAfter,\n  addRowBefore,\n  CellSelection,\n  columnResizing,\n  deleteColumn,\n  deleteRow,\n  deleteTable,\n  fixTables,\n  goToNextCell,\n  mergeCells,\n  setCellAttr,\n  splitCell,\n  tableEditing,\n  toggleHeader,\n  toggleHeaderCell,\n} from '@tiptap/pm/tables'\nimport type { EditorView, NodeView } from '@tiptap/pm/view'\n\nimport { type TableCellAlign, normalizeTableCellAlign } from '../utils/parseAlign.js'\nimport { TableView } from './TableView.js'\nimport { createColGroup } from './utilities/createColGroup.js'\nimport { createTable } from './utilities/createTable.js'\nimport { deleteTableWhenAllCellsSelected } from './utilities/deleteTableWhenAllCellsSelected.js'\nimport { keepCursorInTable } from './utilities/keepCursorInTable.js'\nimport renderTableToMarkdown, { preprocessTablePipes } from './utilities/markdown.js'\nimport { preserveCellSelectionOnContextMenu } from './utilities/preserveCellSelectionOnContextMenu.js'\n\ntype MarkdownTableToken = {\n  align?: Array<TableCellAlign | null>\n  header?: { tokens: MarkdownToken[]; align?: TableCellAlign | null }[]\n  rows?: { tokens: MarkdownToken[]; align?: TableCellAlign | null }[][]\n} & MarkdownToken\n\nexport interface TableOptions {\n  /**\n   * HTML attributes for the table element.\n   * @default {}\n   * @example { class: 'foo' }\n   */\n  HTMLAttributes: Record<string, any>\n\n  /**\n   * Enables the resizing of tables.\n   * @default false\n   * @example true\n   */\n  resizable: boolean\n\n  /**\n   * Controls whether the table should be wrapped in a div with class \"tableWrapper\" when rendered.\n   * In editable mode with resizable tables, this wrapper is always present via TableView.\n   * @default false\n   * @example true\n   */\n  renderWrapper: boolean\n\n  /**\n   * The width of the resize handle.\n   * @default 5\n   * @example 10\n   */\n  handleWidth: number\n\n  /**\n   * The minimum width of a cell.\n   * @default 25\n   * @example 50\n   */\n  cellMinWidth: number\n\n  /**\n   * The node view to render the table.\n   * @default TableView\n   */\n  View:\n    | (new (\n        node: ProseMirrorNode,\n        cellMinWidth: number,\n        view: EditorView,\n        HTMLAttributes?: Record<string, any>,\n      ) => NodeView)\n    | null\n\n  /**\n   * Enables the resizing of the last column.\n   * @default true\n   * @example false\n   */\n  lastColumnResizable: boolean\n\n  /**\n   * Allow table node selection.\n   * @default false\n   * @example true\n   */\n  allowTableNodeSelection: boolean\n}\n\ndeclare module '@tiptap/core' {\n  interface Commands<ReturnType> {\n    table: {\n      /**\n       * Insert a table\n       * @param options The table attributes\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })\n       */\n      insertTable: (options?: {\n        rows?: number\n        cols?: number\n        withHeaderRow?: boolean\n      }) => ReturnType\n\n      /**\n       * Add a column before the current column\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.addColumnBefore()\n       */\n      addColumnBefore: () => ReturnType\n\n      /**\n       * Add a column after the current column\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.addColumnAfter()\n       */\n      addColumnAfter: () => ReturnType\n\n      /**\n       * Delete the current column\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.deleteColumn()\n       */\n      deleteColumn: () => ReturnType\n\n      /**\n       * Add a row before the current row\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.addRowBefore()\n       */\n      addRowBefore: () => ReturnType\n\n      /**\n       * Add a row after the current row\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.addRowAfter()\n       */\n      addRowAfter: () => ReturnType\n\n      /**\n       * Delete the current row\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.deleteRow()\n       */\n      deleteRow: () => ReturnType\n\n      /**\n       * Delete the current table\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.deleteTable()\n       */\n      deleteTable: () => ReturnType\n\n      /**\n       * Merge the currently selected cells\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.mergeCells()\n       */\n      mergeCells: () => ReturnType\n\n      /**\n       * Split the currently selected cell\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.splitCell()\n       */\n      splitCell: () => ReturnType\n\n      /**\n       * Toggle the header column\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.toggleHeaderColumn()\n       */\n      toggleHeaderColumn: () => ReturnType\n\n      /**\n       * Toggle the header row\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.toggleHeaderRow()\n       */\n      toggleHeaderRow: () => ReturnType\n\n      /**\n       * Toggle the header cell\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.toggleHeaderCell()\n       */\n      toggleHeaderCell: () => ReturnType\n\n      /**\n       * Merge or split the currently selected cells\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.mergeOrSplit()\n       */\n      mergeOrSplit: () => ReturnType\n\n      /**\n       * Set a cell attribute\n       * @param name The attribute name\n       * @param value The attribute value\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.setCellAttribute('align', 'right')\n       */\n      setCellAttribute: (name: string, value: any) => ReturnType\n\n      /**\n       * Moves the selection to the next cell\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.goToNextCell()\n       */\n      goToNextCell: () => ReturnType\n\n      /**\n       * Moves the selection to the previous cell\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.goToPreviousCell()\n       */\n      goToPreviousCell: () => ReturnType\n\n      /**\n       * Try to fix the table structure if necessary\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.fixTables()\n       */\n      fixTables: () => ReturnType\n\n      /**\n       * Set a cell selection inside the current table\n       * @param position The cell position\n       * @returns True if the command was successful, otherwise false\n       * @example editor.commands.setCellSelection({ anchorCell: 1, headCell: 2 })\n       */\n      setCellSelection: (position: { anchorCell: number; headCell?: number }) => ReturnType\n    }\n  }\n}\n\n/**\n * This extension allows you to create tables.\n * @see https://www.tiptap.dev/api/nodes/table\n */\nexport const Table = Node.create<TableOptions>({\n  name: 'table',\n\n  // @ts-ignore\n  addOptions() {\n    return {\n      HTMLAttributes: {},\n      resizable: false,\n      renderWrapper: false,\n      handleWidth: 5,\n      cellMinWidth: 25,\n      // TODO: fix\n      View: TableView,\n      lastColumnResizable: true,\n      allowTableNodeSelection: false,\n    }\n  },\n\n  content: 'tableRow+',\n\n  tableRole: 'table',\n\n  isolating: true,\n\n  group: 'block',\n\n  parseHTML() {\n    return [{ tag: 'table' }]\n  },\n\n  renderHTML({ node, HTMLAttributes }) {\n    const { colgroup, tableWidth, tableMinWidth } = createColGroup(node, this.options.cellMinWidth)\n\n    const userStyles = HTMLAttributes.style as string | undefined\n\n    function getTableStyle() {\n      if (userStyles) {\n        return userStyles\n      }\n\n      return tableWidth ? `width: ${tableWidth}` : `min-width: ${tableMinWidth}`\n    }\n\n    const table: DOMOutputSpec = [\n      'table',\n      mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {\n        style: getTableStyle(),\n      }),\n      colgroup,\n      ['tbody', 0],\n    ]\n\n    return this.options.renderWrapper ? ['div', { class: 'tableWrapper' }, table] : table\n  },\n\n  parseMarkdown: (token: MarkdownTableToken, h) => {\n    const rows = []\n    const alignments = Array.isArray(token.align) ? token.align : []\n\n    if (token.header) {\n      const headerCells: JSONContent[] = []\n\n      token.header.forEach((cell, index) => {\n        const align = normalizeTableCellAlign(alignments[index] ?? cell.align)\n        const attrs = align ? { align } : {}\n\n        headerCells.push(\n          h.createNode('tableHeader', attrs, [\n            { type: 'paragraph', content: h.parseInline(cell.tokens) },\n          ]),\n        )\n      })\n\n      rows.push(h.createNode('tableRow', {}, headerCells))\n    }\n\n    if (token.rows) {\n      token.rows.forEach(row => {\n        const bodyCells: JSONContent[] = []\n        row.forEach((cell, index) => {\n          const align = normalizeTableCellAlign(alignments[index] ?? cell.align)\n          const attrs = align ? { align } : {}\n\n          bodyCells.push(\n            h.createNode('tableCell', attrs, [\n              { type: 'paragraph', content: h.parseInline(cell.tokens) },\n            ]),\n          )\n        })\n        rows.push(h.createNode('tableRow', {}, bodyCells))\n      })\n    }\n\n    return h.createNode('table', undefined, rows)\n  },\n\n  renderMarkdown: (node, h) => {\n    return renderTableToMarkdown(node, h)\n  },\n\n  markdownTokenizer: {\n    name: 'table',\n    level: 'block' as const,\n    start: (src: string) => {\n      const lines = src.split('\\n')\n      if (lines.length < 2) return -1\n      const sep = lines[1]\n      if (!/^[ \\t|:]*-[ \\t|:-]*$/.test(sep) || !sep.includes('|')) return -1\n      return lines[0].includes('|') ? 0 : -1\n    },\n    tokenize(src, _tokens, helper) {\n      // Marked terminates a table block at a blank line. Slicing to the first\n      // \\n\\n keeps helper.blockTokens isolated to the candidate table so it\n      // cannot consume content that follows. When no blank line exists the\n      // full remaining source is used and marked's own table regex determines\n      // the boundary (it excludes headings, fences, blockquotes, etc.).\n      const blankLineIndex = src.indexOf('\\n\\n')\n      const candidate = blankLineIndex >= 0 ? src.slice(0, blankLineIndex) : src\n\n      // A GFM table needs at least a header and a separator row (two lines).\n      const candidateLines = candidate.split('\\n')\n      if (candidateLines.length < 2) return undefined\n\n      // Guard: the second line must match a GFM delimiter row (dashes, colons,\n      // pipes, spaces) AND must contain at least one '|'. A bare '---' matches\n      // the dash pattern but is a setext heading marker, not a table separator.\n      // Calling helper.blockTokens on non-table content contaminates the outer\n      // lexer's inline queue with preprocessed (backslash-modified) content.\n      const sep = candidateLines[1]\n      if (!/^[ \\t|:]*-[ \\t|:-]*$/.test(sep) || !sep.includes('|')) return undefined\n\n      const preprocessed = preprocessTablePipes(candidate)\n\n      // Nothing to fix — let marked's built-in handle it.\n      if (preprocessed === candidate) return undefined\n\n      // Re-lex only the preprocessed candidate. The recursive call to our\n      // tokenizer finds no unescaped pipes left inside code spans and returns\n      // undefined, so marked's built-in table tokenizer produces\n      // correctly-split cells.\n      const block = helper.blockTokens(preprocessed)\n      const tableToken = block[0]\n      if (tableToken?.type !== 'table' || !tableToken.raw) return undefined\n\n      // preprocessTablePipes only inserts backslashes (never adds or removes\n      // newlines), so line N in preprocessed maps 1-to-1 to line N in src.\n      // Use the token's line count to reconstruct raw from the original src so\n      // marked advances its cursor by the correct amount.\n      const lineCount = tableToken.raw.split('\\n').length\n      const raw = src.split('\\n').slice(0, lineCount).join('\\n')\n\n      return { ...tableToken, raw }\n    },\n  },\n\n  addCommands() {\n    return {\n      insertTable:\n        ({ rows = 3, cols = 3, withHeaderRow = true } = {}) =>\n        ({ tr, dispatch, editor }) => {\n          const node = createTable(editor.schema, rows, cols, withHeaderRow)\n\n          if (dispatch) {\n            const offset = tr.selection.from + 1\n\n            tr.replaceSelectionWith(node)\n              .scrollIntoView()\n              .setSelection(TextSelection.near(tr.doc.resolve(offset)))\n          }\n\n          return true\n        },\n      addColumnBefore:\n        () =>\n        ({ state, dispatch }) => {\n          return addColumnBefore(state, dispatch)\n        },\n      addColumnAfter:\n        () =>\n        ({ state, dispatch }) => {\n          return addColumnAfter(state, dispatch)\n        },\n      deleteColumn:\n        () =>\n        ({ state, dispatch }) => {\n          const table = findParentNodeClosestToPos(\n            state.selection.$from,\n            node => node.type.name === 'table',\n          )\n\n          return deleteColumn(\n            state,\n            dispatch &&\n              (tr => {\n                if (table) {\n                  keepCursorInTable(tr, table.pos)\n                }\n\n                dispatch(tr)\n              }),\n          )\n        },\n      addRowBefore:\n        () =>\n        ({ state, dispatch }) => {\n          return addRowBefore(state, dispatch)\n        },\n      addRowAfter:\n        () =>\n        ({ state, dispatch }) => {\n          return addRowAfter(state, dispatch)\n        },\n      deleteRow:\n        () =>\n        ({ state, dispatch }) => {\n          const table = findParentNodeClosestToPos(\n            state.selection.$from,\n            node => node.type.name === 'table',\n          )\n\n          return deleteRow(\n            state,\n            dispatch &&\n              (tr => {\n                if (table) {\n                  keepCursorInTable(tr, table.pos)\n                }\n\n                dispatch(tr)\n              }),\n          )\n        },\n      deleteTable:\n        () =>\n        ({ state, dispatch }) => {\n          return deleteTable(state, dispatch)\n        },\n      mergeCells:\n        () =>\n        ({ state, dispatch }) => {\n          return mergeCells(state, dispatch)\n        },\n      splitCell:\n        () =>\n        ({ state, dispatch }) => {\n          return splitCell(state, dispatch)\n        },\n      toggleHeaderColumn:\n        () =>\n        ({ state, dispatch }) => {\n          return toggleHeader('column')(state, dispatch)\n        },\n      toggleHeaderRow:\n        () =>\n        ({ state, dispatch }) => {\n          return toggleHeader('row')(state, dispatch)\n        },\n      toggleHeaderCell:\n        () =>\n        ({ state, dispatch }) => {\n          return toggleHeaderCell(state, dispatch)\n        },\n      mergeOrSplit:\n        () =>\n        ({ state, dispatch }) => {\n          if (mergeCells(state, dispatch)) {\n            return true\n          }\n\n          return splitCell(state, dispatch)\n        },\n      setCellAttribute:\n        (name, value) =>\n        ({ state, dispatch }) => {\n          return setCellAttr(name, value)(state, dispatch)\n        },\n      goToNextCell:\n        () =>\n        ({ state, dispatch }) => {\n          return goToNextCell(1)(state, dispatch)\n        },\n      goToPreviousCell:\n        () =>\n        ({ state, dispatch }) => {\n          return goToNextCell(-1)(state, dispatch)\n        },\n      fixTables:\n        () =>\n        ({ state, dispatch }) => {\n          if (dispatch) {\n            fixTables(state)\n          }\n\n          return true\n        },\n      setCellSelection:\n        position =>\n        ({ tr, dispatch }) => {\n          if (dispatch) {\n            const selection = CellSelection.create(tr.doc, position.anchorCell, position.headCell)\n\n            // @ts-ignore\n            tr.setSelection(selection)\n          }\n\n          return true\n        },\n    }\n  },\n\n  addKeyboardShortcuts() {\n    return {\n      Tab: () => {\n        if (this.editor.commands.goToNextCell()) {\n          return true\n        }\n\n        if (!this.editor.can().addRowAfter()) {\n          return false\n        }\n\n        return this.editor.chain().addRowAfter().goToNextCell().run()\n      },\n      'Shift-Tab': () => this.editor.commands.goToPreviousCell(),\n      Backspace: deleteTableWhenAllCellsSelected,\n      'Mod-Backspace': deleteTableWhenAllCellsSelected,\n      Delete: deleteTableWhenAllCellsSelected,\n      'Mod-Delete': deleteTableWhenAllCellsSelected,\n    }\n  },\n\n  addProseMirrorPlugins() {\n    const isResizable = this.options.resizable && this.editor.isEditable\n\n    return [\n      ...(isResizable\n        ? [\n            columnResizing({\n              handleWidth: this.options.handleWidth,\n              cellMinWidth: this.options.cellMinWidth,\n              defaultCellMinWidth: this.options.cellMinWidth,\n              // Let Tiptap render the table attributes.\n              View: null,\n              lastColumnResizable: this.options.lastColumnResizable,\n            }),\n          ]\n        : []),\n      tableEditing({\n        allowTableNodeSelection: this.options.allowTableNodeSelection,\n      }),\n      preserveCellSelectionOnContextMenu(),\n    ]\n  },\n\n  addNodeView() {\n    const View = this.options.View\n\n    if (!View) {\n      return null\n    }\n\n    return ({ node, view, HTMLAttributes }) => {\n      const mergedAttributes = mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)\n\n      return new View(node, this.options.cellMinWidth, view, mergedAttributes) as NodeView\n    }\n  },\n\n  extendNodeSchema(extension) {\n    const context = {\n      name: extension.name,\n      options: extension.options,\n      storage: extension.storage,\n    }\n\n    return {\n      tableRole: callOrReturn(getExtensionField(extension, 'tableRole', context)),\n    }\n  },\n})\n"],"mappings":";;;;;;;;;;;AAiBA,SAAgB,wBAAwB,OAAuC;CAC7E,IACE,UAAA,UACA,UAAA,WACA,UAAA,UAEA,OAAO;CAGT,OAAO;AACT;;;;;;;AAyBA,SAAgB,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