@tiptap/extension-table 3.0.0 → 3.0.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +5 -1
  3. package/dist/cell/index.cjs +68 -0
  4. package/dist/cell/index.cjs.map +1 -0
  5. package/dist/cell/index.d.cts +33 -0
  6. package/dist/cell/index.d.ts +33 -0
  7. package/dist/cell/index.js +41 -0
  8. package/dist/cell/index.js.map +1 -0
  9. package/dist/header/index.cjs +68 -0
  10. package/dist/header/index.cjs.map +1 -0
  11. package/dist/header/index.d.cts +33 -0
  12. package/dist/header/index.d.ts +33 -0
  13. package/dist/header/index.js +41 -0
  14. package/dist/header/index.js.map +1 -0
  15. package/dist/index.cjs +480 -321
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +305 -0
  18. package/dist/index.d.ts +305 -0
  19. package/dist/index.js +465 -316
  20. package/dist/index.js.map +1 -1
  21. package/dist/kit/index.cjs +497 -0
  22. package/dist/kit/index.cjs.map +1 -0
  23. package/dist/kit/index.d.cts +252 -0
  24. package/dist/kit/index.d.ts +252 -0
  25. package/dist/kit/index.js +490 -0
  26. package/dist/kit/index.js.map +1 -0
  27. package/dist/row/index.cjs +49 -0
  28. package/dist/row/index.cjs.map +1 -0
  29. package/dist/row/index.d.cts +33 -0
  30. package/dist/row/index.d.ts +33 -0
  31. package/dist/row/index.js +22 -0
  32. package/dist/row/index.js.map +1 -0
  33. package/dist/table/index.cjs +384 -0
  34. package/dist/table/index.cjs.map +1 -0
  35. package/dist/{packages/extension-table/src/table.d.ts → table/index.d.cts} +45 -19
  36. package/dist/table/index.d.ts +220 -0
  37. package/dist/table/index.js +373 -0
  38. package/dist/table/index.js.map +1 -0
  39. package/package.json +53 -11
  40. package/src/cell/index.ts +1 -0
  41. package/src/cell/table-cell.ts +60 -0
  42. package/src/header/index.ts +1 -0
  43. package/src/header/table-header.ts +60 -0
  44. package/src/index.ts +6 -7
  45. package/src/kit/index.ts +64 -0
  46. package/src/row/index.ts +1 -0
  47. package/src/row/table-row.ts +38 -0
  48. package/src/table/TableView.ts +108 -0
  49. package/src/table/index.ts +3 -0
  50. package/src/{table.ts → table/table.ts} +56 -64
  51. package/src/table/utilities/colStyle.ts +9 -0
  52. package/src/{utilities → table/utilities}/createCell.ts +1 -1
  53. package/src/{utilities → table/utilities}/createColGroup.ts +24 -6
  54. package/src/{utilities → table/utilities}/createTable.ts +1 -1
  55. package/src/{utilities → table/utilities}/deleteTableWhenAllCellsSelected.ts +2 -1
  56. package/src/{utilities → table/utilities}/getTableNodeTypes.ts +1 -1
  57. package/src/types.ts +19 -0
  58. package/dist/index.umd.js +0 -358
  59. package/dist/index.umd.js.map +0 -1
  60. package/dist/packages/core/src/CommandManager.d.ts +0 -20
  61. package/dist/packages/core/src/Editor.d.ts +0 -161
  62. package/dist/packages/core/src/EventEmitter.d.ts +0 -11
  63. package/dist/packages/core/src/Extension.d.ts +0 -343
  64. package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
  65. package/dist/packages/core/src/InputRule.d.ts +0 -42
  66. package/dist/packages/core/src/Mark.d.ts +0 -451
  67. package/dist/packages/core/src/Node.d.ts +0 -611
  68. package/dist/packages/core/src/NodePos.d.ts +0 -44
  69. package/dist/packages/core/src/NodeView.d.ts +0 -31
  70. package/dist/packages/core/src/PasteRule.d.ts +0 -50
  71. package/dist/packages/core/src/Tracker.d.ts +0 -11
  72. package/dist/packages/core/src/commands/blur.d.ts +0 -13
  73. package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
  74. package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
  75. package/dist/packages/core/src/commands/command.d.ts +0 -18
  76. package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
  77. package/dist/packages/core/src/commands/cut.d.ts +0 -20
  78. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
  79. package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
  80. package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
  81. package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
  82. package/dist/packages/core/src/commands/enter.d.ts +0 -13
  83. package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
  84. package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
  85. package/dist/packages/core/src/commands/first.d.ts +0 -14
  86. package/dist/packages/core/src/commands/focus.d.ts +0 -27
  87. package/dist/packages/core/src/commands/forEach.d.ts +0 -14
  88. package/dist/packages/core/src/commands/index.d.ts +0 -55
  89. package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
  90. package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
  91. package/dist/packages/core/src/commands/join.d.ts +0 -41
  92. package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
  93. package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
  94. package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
  95. package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
  96. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
  97. package/dist/packages/core/src/commands/lift.d.ts +0 -17
  98. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
  99. package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
  100. package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
  101. package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
  102. package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
  103. package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
  104. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
  105. package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
  106. package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
  107. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
  108. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
  109. package/dist/packages/core/src/commands/setContent.d.ts +0 -40
  110. package/dist/packages/core/src/commands/setMark.d.ts +0 -15
  111. package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
  112. package/dist/packages/core/src/commands/setNode.d.ts +0 -16
  113. package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
  114. package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
  115. package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
  116. package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
  117. package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
  118. package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
  119. package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
  120. package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
  121. package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
  122. package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
  123. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
  124. package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
  125. package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
  126. package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
  127. package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
  128. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
  129. package/dist/packages/core/src/extensions/commands.d.ts +0 -3
  130. package/dist/packages/core/src/extensions/editable.d.ts +0 -2
  131. package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
  132. package/dist/packages/core/src/extensions/index.d.ts +0 -6
  133. package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
  134. package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
  135. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
  136. package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
  137. package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
  138. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
  139. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
  140. package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
  141. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
  142. package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
  143. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
  144. package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
  145. package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
  146. package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
  147. package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
  148. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
  149. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
  150. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
  151. package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
  152. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
  153. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
  154. package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
  155. package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
  156. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
  157. package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
  158. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
  159. package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
  160. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
  161. package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
  162. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
  163. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
  164. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
  165. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
  166. package/dist/packages/core/src/helpers/getText.d.ts +0 -15
  167. package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
  168. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
  169. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
  170. package/dist/packages/core/src/helpers/index.d.ts +0 -50
  171. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
  172. package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
  173. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
  174. package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
  175. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
  176. package/dist/packages/core/src/helpers/isList.d.ts +0 -2
  177. package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
  178. package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
  179. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
  180. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
  181. package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
  182. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
  183. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
  184. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
  185. package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
  186. package/dist/packages/core/src/index.d.ts +0 -24
  187. package/dist/packages/core/src/inputRules/index.d.ts +0 -5
  188. package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
  189. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
  190. package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
  191. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
  192. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
  193. package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
  194. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
  195. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
  196. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
  197. package/dist/packages/core/src/style.d.ts +0 -1
  198. package/dist/packages/core/src/types.d.ts +0 -255
  199. package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
  200. package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
  201. package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
  202. package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
  203. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
  204. package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
  205. package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
  206. package/dist/packages/core/src/utilities/index.d.ts +0 -20
  207. package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
  208. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
  209. package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
  210. package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
  211. package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
  212. package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
  213. package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
  214. package/dist/packages/core/src/utilities/isString.d.ts +0 -1
  215. package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
  216. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
  217. package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
  218. package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
  219. package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
  220. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
  221. package/dist/packages/extension-table/src/TableView.d.ts +0 -17
  222. package/dist/packages/extension-table/src/index.d.ts +0 -5
  223. package/dist/packages/extension-table/src/utilities/createCell.d.ts +0 -2
  224. package/dist/packages/extension-table/src/utilities/createColGroup.d.ts +0 -19
  225. package/dist/packages/extension-table/src/utilities/createTable.d.ts +0 -2
  226. package/dist/packages/extension-table/src/utilities/deleteTableWhenAllCellsSelected.d.ts +0 -2
  227. package/dist/packages/extension-table/src/utilities/getTableNodeTypes.d.ts +0 -4
  228. package/dist/packages/extension-table/src/utilities/isCellSelection.d.ts +0 -2
  229. package/src/TableView.ts +0 -100
  230. /package/src/{utilities → table/utilities}/isCellSelection.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/TableView.ts","../src/utilities/createColGroup.ts","../src/utilities/createCell.ts","../src/utilities/getTableNodeTypes.ts","../src/utilities/createTable.ts","../src/utilities/isCellSelection.ts","../src/utilities/deleteTableWhenAllCellsSelected.ts","../src/table.ts"],"sourcesContent":["// @ts-nocheck\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { NodeView } from '@tiptap/pm/view'\n\nexport function updateColumns(\n node: ProseMirrorNode,\n colgroup: Element,\n table: Element,\n cellMinWidth: number,\n overrideCol?: number,\n overrideValue?: any,\n) {\n let totalWidth = 0\n let fixedWidth = true\n let nextDOM = colgroup.firstChild\n const row = node.firstChild\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 = overrideCol === col ? overrideValue : colwidth && colwidth[j]\n const cssWidth = hasWidth ? `${hasWidth}px` : ''\n\n totalWidth += hasWidth || cellMinWidth\n\n if (!hasWidth) {\n fixedWidth = false\n }\n\n if (!nextDOM) {\n colgroup.appendChild(document.createElement('col')).style.width = cssWidth\n } else {\n if (nextDOM.style.width !== cssWidth) {\n nextDOM.style.width = cssWidth\n }\n\n nextDOM = nextDOM.nextSibling\n }\n }\n }\n\n while (nextDOM) {\n const after = nextDOM.nextSibling\n\n nextDOM.parentNode.removeChild(nextDOM)\n nextDOM = after\n }\n\n if (fixedWidth) {\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: Element\n\n table: Element\n\n colgroup: Element\n\n contentDOM: Element\n\n constructor(node: ProseMirrorNode, cellMinWidth: number) {\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 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 if (node.type !== this.node.type) {\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: MutationRecord | { type: 'selection'; target: Element }) {\n return (\n mutation.type === 'attributes'\n && (mutation.target === this.table || this.colgroup.contains(mutation.target))\n )\n }\n}\n","import { DOMOutputSpec, Node as ProseMirrorNode } from '@tiptap/pm/model'\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(\n node: ProseMirrorNode,\n cellMinWidth: number,\n overrideCol?: number,\n overrideValue?: any,\n) {\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 = overrideCol === col ? overrideValue : colwidth && colwidth[j]\n const cssWidth = hasWidth ? `${hasWidth}px` : ''\n\n totalWidth += hasWidth || cellMinWidth\n\n if (!hasWidth) {\n fixedWidth = false\n }\n\n cols.push(['col', cssWidth ? { style: `width: ${cssWidth}` } : {}])\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 { 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 { 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 { 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 { findParentNodeClosestToPos, KeyboardShortcutCommand } 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 {\n callOrReturn, getExtensionField, mergeAttributes, Node, ParentConfig,\n} from '@tiptap/core'\nimport { DOMOutputSpec } 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 { NodeView } from '@tiptap/pm/view'\n\nimport { TableView } from './TableView.js'\nimport { createColGroup } from './utilities/createColGroup.js'\nimport { createTable } from './utilities/createTable.js'\nimport { deleteTableWhenAllCellsSelected } from './utilities/deleteTableWhenAllCellsSelected.js'\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 * 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: NodeView\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 interface NodeConfig<Options, Storage> {\n /**\n * A string or function to determine the role of the table.\n * @default 'table'\n * @example () => 'table'\n */\n tableRole?:\n | string\n | ((this: {\n name: string\n options: Options\n storage: Storage\n parent: ParentConfig<NodeConfig<Options>>['tableRole']\n }) => string)\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 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(\n node,\n this.options.cellMinWidth,\n )\n\n const table: DOMOutputSpec = [\n 'table',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {\n style: tableWidth\n ? `width: ${tableWidth}`\n : `minWidth: ${tableMinWidth}`,\n }),\n colgroup,\n ['tbody', 0],\n ]\n\n return table\n },\n\n addCommands() {\n return {\n insertTable:\n ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ 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 () => ({ state, dispatch }) => {\n return addColumnBefore(state, dispatch)\n },\n addColumnAfter:\n () => ({ state, dispatch }) => {\n return addColumnAfter(state, dispatch)\n },\n deleteColumn:\n () => ({ state, dispatch }) => {\n return deleteColumn(state, dispatch)\n },\n addRowBefore:\n () => ({ state, dispatch }) => {\n return addRowBefore(state, dispatch)\n },\n addRowAfter:\n () => ({ state, dispatch }) => {\n return addRowAfter(state, dispatch)\n },\n deleteRow:\n () => ({ state, dispatch }) => {\n return deleteRow(state, dispatch)\n },\n deleteTable:\n () => ({ state, dispatch }) => {\n return deleteTable(state, dispatch)\n },\n mergeCells:\n () => ({ state, dispatch }) => {\n return mergeCells(state, dispatch)\n },\n splitCell:\n () => ({ state, dispatch }) => {\n return splitCell(state, dispatch)\n },\n toggleHeaderColumn:\n () => ({ state, dispatch }) => {\n return toggleHeader('column')(state, dispatch)\n },\n toggleHeaderRow:\n () => ({ state, dispatch }) => {\n return toggleHeader('row')(state, dispatch)\n },\n toggleHeaderCell:\n () => ({ state, dispatch }) => {\n return toggleHeaderCell(state, dispatch)\n },\n mergeOrSplit:\n () => ({ state, dispatch }) => {\n if (mergeCells(state, dispatch)) {\n return true\n }\n\n return splitCell(state, dispatch)\n },\n setCellAttribute:\n (name, value) => ({ state, dispatch }) => {\n return setCellAttr(name, value)(state, dispatch)\n },\n goToNextCell:\n () => ({ state, dispatch }) => {\n return goToNextCell(1)(state, dispatch)\n },\n goToPreviousCell:\n () => ({ state, dispatch }) => {\n return goToNextCell(-1)(state, dispatch)\n },\n fixTables:\n () => ({ state, dispatch }) => {\n if (dispatch) {\n fixTables(state)\n }\n\n return true\n },\n setCellSelection:\n position => ({ 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 // @ts-ignore (incorrect type)\n View: this.options.View,\n // TODO: PR for @types/prosemirror-tables\n // @ts-ignore (incorrect type)\n lastColumnResizable: this.options.lastColumnResizable,\n }),\n ]\n : []),\n tableEditing({\n allowTableNodeSelection: this.options.allowTableNodeSelection,\n }),\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"],"names":["CellSelection","findParentNodeClosestToPos","Node","mergeAttributes","TextSelection","addColumnBefore","addColumnAfter","deleteColumn","addRowBefore","addRowAfter","deleteRow","deleteTable","mergeCells","splitCell","toggleHeader","toggleHeaderCell","setCellAttr","goToNextCell","fixTables","columnResizing","tableEditing","callOrReturn","getExtensionField"],"mappings":";;;;;;;;AAIgB,SAAA,aAAa,CAC3B,IAAqB,EACrB,QAAiB,EACjB,KAAc,EACd,YAAoB,EACpB,WAAoB,EACpB,aAAmB,EAAA;IAEnB,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,IAAI,UAAU,GAAG,IAAI,CAAA;AACrB,IAAA,IAAI,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAA;AACjC,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAA;AAE3B,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE;AACnD,QAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AAEhD,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE;AAC7C,YAAA,MAAM,QAAQ,GAAG,WAAW,KAAK,GAAG,GAAG,aAAa,GAAG,QAA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ACvC,YAAA,YAAY,EAAE,+BAA+B;SAC9C,CAAA;KACF;IAED,qBAAqB,GAAA;AACnB,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;QAEpE,OAAO;AACL,YAAA,IAAI,WAAW;AACb,kBAAE;AACA,oBAAAmB,qBAAc,CAAC;AACb,wBAAA,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;AACrC,wBAAA,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;;AAEvC,wBAAA,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;;;AAGvB,wBAAA,mBAAmB,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB;qBACtD,CAAC;AACH,iBAAA;kBACC,EAAE;AACN,YAAAC,mBAAY,CAAC;AACX,gBAAA,uBAAuB,EAAE,IAAI,CAAC,OAAO,CAAC,uBAAuB;aAC9D,CAAC;SACH,CAAA;KACF;AAED,IAAA,gBAAgB,CAAC,SAAS,EAAA;AACxB,QAAA,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,OAAO,EAAE,SAAS,CAAC,OAAO;SAC3B,CAAA;QAED,OAAO;YACL,SAAS,EAAEC,iBAAY,CAACC,sBAAiB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;SAC5E,CAAA;KACF;AACF,CAAA;;;;;;;"}
1
+ {"version":3,"sources":["../src/index.ts","../src/cell/table-cell.ts","../src/header/table-header.ts","../src/kit/index.ts","../src/row/table-row.ts","../src/table/table.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/deleteTableWhenAllCellsSelected.ts","../src/table/utilities/isCellSelection.ts"],"sourcesContent":["export * from './cell/index.js'\nexport * from './header/index.js'\nexport * from './kit/index.js'\nexport * from './row/index.js'\nexport * from './table/index.js'\nexport * from './table/TableView.js'\n","import '../types.js'\n\nimport { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface TableCellOptions {\n /**\n * The HTML attributes for a table cell node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\n/**\n * This extension allows you to create table cells.\n * @see https://www.tiptap.dev/api/nodes/table-cell\n */\nexport const TableCell = Node.create<TableCellOptions>({\n name: 'tableCell',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n content: 'block+',\n\n addAttributes() {\n return {\n colspan: {\n default: 1,\n },\n rowspan: {\n default: 1,\n },\n colwidth: {\n default: null,\n parseHTML: element => {\n const colwidth = element.getAttribute('colwidth')\n const value = colwidth ? colwidth.split(',').map(width => parseInt(width, 10)) : null\n\n return value\n },\n },\n }\n },\n\n tableRole: 'cell',\n\n isolating: true,\n\n parseHTML() {\n return [{ tag: 'td' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['td', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n})\n","import '../types.js'\n\nimport { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface TableHeaderOptions {\n /**\n * The HTML attributes for a table header node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\n/**\n * This extension allows you to create table headers.\n * @see https://www.tiptap.dev/api/nodes/table-header\n */\nexport const TableHeader = Node.create<TableHeaderOptions>({\n name: 'tableHeader',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n content: 'block+',\n\n addAttributes() {\n return {\n colspan: {\n default: 1,\n },\n rowspan: {\n default: 1,\n },\n colwidth: {\n default: null,\n parseHTML: element => {\n const colwidth = element.getAttribute('colwidth')\n const value = colwidth ? colwidth.split(',').map(width => parseInt(width, 10)) : null\n\n return value\n },\n },\n }\n },\n\n tableRole: 'header_cell',\n\n isolating: true,\n\n parseHTML() {\n return [{ tag: 'th' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['th', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n})\n","import { Extension } from '@tiptap/core'\n\nimport type { TableCellOptions } from '../cell/index.js'\nimport { TableCell } from '../cell/index.js'\nimport type { TableHeaderOptions } from '../header/index.js'\nimport { TableHeader } from '../header/index.js'\nimport type { TableRowOptions } from '../row/index.js'\nimport { TableRow } from '../row/index.js'\nimport type { TableOptions } from '../table/index.js'\nimport { Table } from '../table/index.js'\n\nexport interface TableKitOptions {\n /**\n * If set to false, the table extension will not be registered\n * @example table: false\n */\n table: Partial<TableOptions> | false\n /**\n * If set to false, the table extension will not be registered\n * @example tableCell: false\n */\n tableCell: Partial<TableCellOptions> | false\n /**\n * If set to false, the table extension will not be registered\n * @example tableHeader: false\n */\n tableHeader: Partial<TableHeaderOptions> | false\n /**\n * If set to false, the table extension will not be registered\n * @example tableRow: false\n */\n tableRow: Partial<TableRowOptions> | false\n}\n\n/**\n * The table kit is a collection of table editor extensions.\n *\n * It’s a good starting point for building your own table in Tiptap.\n */\nexport const TableKit = Extension.create<TableKitOptions>({\n name: 'tableKit',\n\n addExtensions() {\n const extensions = []\n\n if (this.options.table !== false) {\n extensions.push(Table.configure(this.options.table))\n }\n\n if (this.options.tableCell !== false) {\n extensions.push(TableCell.configure(this.options.tableCell))\n }\n\n if (this.options.tableHeader !== false) {\n extensions.push(TableHeader.configure(this.options.tableHeader))\n }\n\n if (this.options.tableRow !== false) {\n extensions.push(TableRow.configure(this.options.tableRow))\n }\n\n return extensions\n },\n})\n","import '../types.js'\n\nimport { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface TableRowOptions {\n /**\n * The HTML attributes for a table row node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\n/**\n * This extension allows you to create table rows.\n * @see https://www.tiptap.dev/api/nodes/table-row\n */\nexport const TableRow = Node.create<TableRowOptions>({\n name: 'tableRow',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n content: '(tableCell | tableHeader)*',\n\n tableRole: 'row',\n\n parseHTML() {\n return [{ tag: 'tr' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['tr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n})\n","import '../types.js'\n\nimport { callOrReturn, getExtensionField, mergeAttributes, Node } 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 { TableView } from './TableView.js'\nimport { createColGroup } from './utilities/createColGroup.js'\nimport { createTable } from './utilities/createTable.js'\nimport { deleteTableWhenAllCellsSelected } from './utilities/deleteTableWhenAllCellsSelected.js'\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 * 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: (new (node: ProseMirrorNode, cellMinWidth: number, view: EditorView) => NodeView) | 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?: { rows?: number; cols?: number; withHeaderRow?: boolean }) => 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 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 table: DOMOutputSpec = [\n 'table',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {\n style: tableWidth ? `width: ${tableWidth}` : `min-width: ${tableMinWidth}`,\n }),\n colgroup,\n ['tbody', 0],\n ]\n\n return table\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 return deleteColumn(state, dispatch)\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 return deleteRow(state, dispatch)\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 View: this.options.View,\n lastColumnResizable: this.options.lastColumnResizable,\n }),\n ]\n : []),\n tableEditing({\n allowTableNodeSelection: this.options.allowTableNodeSelection,\n }),\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","export function getColStyleDeclaration(minWidth: number, width: number | undefined): [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 { 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 = 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 if (fixedWidth) {\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(node: ProseMirrorNode, cellMinWidth: number) {\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 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 if (node.type !== this.node.type) {\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 return mutation.type === 'attributes' && (mutation.target === this.table || this.colgroup.contains(mutation.target))\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 = 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 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 { CellSelection } from '@tiptap/pm/tables'\n\nexport function isCellSelection(value: unknown): value is CellSelection {\n return value instanceof CellSelection\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,kBAAsC;AAe/B,IAAM,YAAY,iBAAK,OAAyB;AAAA,EACrD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,SAAS;AAAA,EAET,gBAAgB;AACd,WAAO;AAAA,MACL,SAAS;AAAA,QACP,SAAS;AAAA,MACX;AAAA,MACA,SAAS;AAAA,QACP,SAAS;AAAA,MACX;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,WAAW,aAAW;AACpB,gBAAM,WAAW,QAAQ,aAAa,UAAU;AAChD,gBAAM,QAAQ,WAAW,SAAS,MAAM,GAAG,EAAE,IAAI,WAAS,SAAS,OAAO,EAAE,CAAC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SAAS,UAAU,KAAK,QAAQ,QAAQ,CAAC;AAAA,IAC3D;AAEA,WAAO;AAAA,EACT;AACF,CAAC;","names":["import_core","import_core","import_core","import_core","import_tables","import_core"]}
@@ -0,0 +1,305 @@
1
+ import { ParentConfig, Node, Extension } from '@tiptap/core';
2
+ import { Node as Node$1, DOMOutputSpec, Schema, Fragment } from '@tiptap/pm/model';
3
+ import { EditorView, NodeView, ViewMutationRecord } from '@tiptap/pm/view';
4
+
5
+ declare module '@tiptap/core' {
6
+ interface NodeConfig<Options, Storage> {
7
+ /**
8
+ * A string or function to determine the role of the table.
9
+ * @default 'table'
10
+ * @example () => 'table'
11
+ */
12
+ tableRole?: string | ((this: {
13
+ name: string;
14
+ options: Options;
15
+ storage: Storage;
16
+ parent: ParentConfig<NodeConfig<Options>>['tableRole'];
17
+ }) => string);
18
+ }
19
+ }
20
+
21
+ interface TableCellOptions {
22
+ /**
23
+ * The HTML attributes for a table cell node.
24
+ * @default {}
25
+ * @example { class: 'foo' }
26
+ */
27
+ HTMLAttributes: Record<string, any>;
28
+ }
29
+ /**
30
+ * This extension allows you to create table cells.
31
+ * @see https://www.tiptap.dev/api/nodes/table-cell
32
+ */
33
+ declare const TableCell: Node<TableCellOptions, any>;
34
+
35
+ interface TableHeaderOptions {
36
+ /**
37
+ * The HTML attributes for a table header node.
38
+ * @default {}
39
+ * @example { class: 'foo' }
40
+ */
41
+ HTMLAttributes: Record<string, any>;
42
+ }
43
+ /**
44
+ * This extension allows you to create table headers.
45
+ * @see https://www.tiptap.dev/api/nodes/table-header
46
+ */
47
+ declare const TableHeader: Node<TableHeaderOptions, any>;
48
+
49
+ interface TableRowOptions {
50
+ /**
51
+ * The HTML attributes for a table row node.
52
+ * @default {}
53
+ * @example { class: 'foo' }
54
+ */
55
+ HTMLAttributes: Record<string, any>;
56
+ }
57
+ /**
58
+ * This extension allows you to create table rows.
59
+ * @see https://www.tiptap.dev/api/nodes/table-row
60
+ */
61
+ declare const TableRow: Node<TableRowOptions, any>;
62
+
63
+ interface TableOptions {
64
+ /**
65
+ * HTML attributes for the table element.
66
+ * @default {}
67
+ * @example { class: 'foo' }
68
+ */
69
+ HTMLAttributes: Record<string, any>;
70
+ /**
71
+ * Enables the resizing of tables.
72
+ * @default false
73
+ * @example true
74
+ */
75
+ resizable: boolean;
76
+ /**
77
+ * The width of the resize handle.
78
+ * @default 5
79
+ * @example 10
80
+ */
81
+ handleWidth: number;
82
+ /**
83
+ * The minimum width of a cell.
84
+ * @default 25
85
+ * @example 50
86
+ */
87
+ cellMinWidth: number;
88
+ /**
89
+ * The node view to render the table.
90
+ * @default TableView
91
+ */
92
+ View: (new (node: Node$1, cellMinWidth: number, view: EditorView) => NodeView) | null;
93
+ /**
94
+ * Enables the resizing of the last column.
95
+ * @default true
96
+ * @example false
97
+ */
98
+ lastColumnResizable: boolean;
99
+ /**
100
+ * Allow table node selection.
101
+ * @default false
102
+ * @example true
103
+ */
104
+ allowTableNodeSelection: boolean;
105
+ }
106
+ declare module '@tiptap/core' {
107
+ interface Commands<ReturnType> {
108
+ table: {
109
+ /**
110
+ * Insert a table
111
+ * @param options The table attributes
112
+ * @returns True if the command was successful, otherwise false
113
+ * @example editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
114
+ */
115
+ insertTable: (options?: {
116
+ rows?: number;
117
+ cols?: number;
118
+ withHeaderRow?: boolean;
119
+ }) => ReturnType;
120
+ /**
121
+ * Add a column before the current column
122
+ * @returns True if the command was successful, otherwise false
123
+ * @example editor.commands.addColumnBefore()
124
+ */
125
+ addColumnBefore: () => ReturnType;
126
+ /**
127
+ * Add a column after the current column
128
+ * @returns True if the command was successful, otherwise false
129
+ * @example editor.commands.addColumnAfter()
130
+ */
131
+ addColumnAfter: () => ReturnType;
132
+ /**
133
+ * Delete the current column
134
+ * @returns True if the command was successful, otherwise false
135
+ * @example editor.commands.deleteColumn()
136
+ */
137
+ deleteColumn: () => ReturnType;
138
+ /**
139
+ * Add a row before the current row
140
+ * @returns True if the command was successful, otherwise false
141
+ * @example editor.commands.addRowBefore()
142
+ */
143
+ addRowBefore: () => ReturnType;
144
+ /**
145
+ * Add a row after the current row
146
+ * @returns True if the command was successful, otherwise false
147
+ * @example editor.commands.addRowAfter()
148
+ */
149
+ addRowAfter: () => ReturnType;
150
+ /**
151
+ * Delete the current row
152
+ * @returns True if the command was successful, otherwise false
153
+ * @example editor.commands.deleteRow()
154
+ */
155
+ deleteRow: () => ReturnType;
156
+ /**
157
+ * Delete the current table
158
+ * @returns True if the command was successful, otherwise false
159
+ * @example editor.commands.deleteTable()
160
+ */
161
+ deleteTable: () => ReturnType;
162
+ /**
163
+ * Merge the currently selected cells
164
+ * @returns True if the command was successful, otherwise false
165
+ * @example editor.commands.mergeCells()
166
+ */
167
+ mergeCells: () => ReturnType;
168
+ /**
169
+ * Split the currently selected cell
170
+ * @returns True if the command was successful, otherwise false
171
+ * @example editor.commands.splitCell()
172
+ */
173
+ splitCell: () => ReturnType;
174
+ /**
175
+ * Toggle the header column
176
+ * @returns True if the command was successful, otherwise false
177
+ * @example editor.commands.toggleHeaderColumn()
178
+ */
179
+ toggleHeaderColumn: () => ReturnType;
180
+ /**
181
+ * Toggle the header row
182
+ * @returns True if the command was successful, otherwise false
183
+ * @example editor.commands.toggleHeaderRow()
184
+ */
185
+ toggleHeaderRow: () => ReturnType;
186
+ /**
187
+ * Toggle the header cell
188
+ * @returns True if the command was successful, otherwise false
189
+ * @example editor.commands.toggleHeaderCell()
190
+ */
191
+ toggleHeaderCell: () => ReturnType;
192
+ /**
193
+ * Merge or split the currently selected cells
194
+ * @returns True if the command was successful, otherwise false
195
+ * @example editor.commands.mergeOrSplit()
196
+ */
197
+ mergeOrSplit: () => ReturnType;
198
+ /**
199
+ * Set a cell attribute
200
+ * @param name The attribute name
201
+ * @param value The attribute value
202
+ * @returns True if the command was successful, otherwise false
203
+ * @example editor.commands.setCellAttribute('align', 'right')
204
+ */
205
+ setCellAttribute: (name: string, value: any) => ReturnType;
206
+ /**
207
+ * Moves the selection to the next cell
208
+ * @returns True if the command was successful, otherwise false
209
+ * @example editor.commands.goToNextCell()
210
+ */
211
+ goToNextCell: () => ReturnType;
212
+ /**
213
+ * Moves the selection to the previous cell
214
+ * @returns True if the command was successful, otherwise false
215
+ * @example editor.commands.goToPreviousCell()
216
+ */
217
+ goToPreviousCell: () => ReturnType;
218
+ /**
219
+ * Try to fix the table structure if necessary
220
+ * @returns True if the command was successful, otherwise false
221
+ * @example editor.commands.fixTables()
222
+ */
223
+ fixTables: () => ReturnType;
224
+ /**
225
+ * Set a cell selection inside the current table
226
+ * @param position The cell position
227
+ * @returns True if the command was successful, otherwise false
228
+ * @example editor.commands.setCellSelection({ anchorCell: 1, headCell: 2 })
229
+ */
230
+ setCellSelection: (position: {
231
+ anchorCell: number;
232
+ headCell?: number;
233
+ }) => ReturnType;
234
+ };
235
+ }
236
+ }
237
+ /**
238
+ * This extension allows you to create tables.
239
+ * @see https://www.tiptap.dev/api/nodes/table
240
+ */
241
+ declare const Table: Node<TableOptions, any>;
242
+
243
+ type ColGroup = {
244
+ colgroup: DOMOutputSpec;
245
+ tableWidth: string;
246
+ tableMinWidth: string;
247
+ } | Record<string, never>;
248
+ /**
249
+ * Creates a colgroup element for a table node in ProseMirror.
250
+ *
251
+ * @param node - The ProseMirror node representing the table.
252
+ * @param cellMinWidth - The minimum width of a cell in the table.
253
+ * @param overrideCol - (Optional) The index of the column to override the width of.
254
+ * @param overrideValue - (Optional) The width value to use for the overridden column.
255
+ * @returns An object containing the colgroup element, the total width of the table, and the minimum width of the table.
256
+ */
257
+ declare function createColGroup(node: Node$1, cellMinWidth: number): ColGroup;
258
+ declare function createColGroup(node: Node$1, cellMinWidth: number, overrideCol: number, overrideValue: number): ColGroup;
259
+
260
+ declare function createTable(schema: Schema, rowsCount: number, colsCount: number, withHeaderRow: boolean, cellContent?: Fragment | Node$1 | Array<Node$1>): Node$1;
261
+
262
+ interface TableKitOptions {
263
+ /**
264
+ * If set to false, the table extension will not be registered
265
+ * @example table: false
266
+ */
267
+ table: Partial<TableOptions> | false;
268
+ /**
269
+ * If set to false, the table extension will not be registered
270
+ * @example tableCell: false
271
+ */
272
+ tableCell: Partial<TableCellOptions> | false;
273
+ /**
274
+ * If set to false, the table extension will not be registered
275
+ * @example tableHeader: false
276
+ */
277
+ tableHeader: Partial<TableHeaderOptions> | false;
278
+ /**
279
+ * If set to false, the table extension will not be registered
280
+ * @example tableRow: false
281
+ */
282
+ tableRow: Partial<TableRowOptions> | false;
283
+ }
284
+ /**
285
+ * The table kit is a collection of table editor extensions.
286
+ *
287
+ * It’s a good starting point for building your own table in Tiptap.
288
+ */
289
+ declare const TableKit: Extension<TableKitOptions, any>;
290
+
291
+ declare function updateColumns(node: Node$1, colgroup: HTMLTableColElement, // <colgroup> has the same prototype as <col>
292
+ table: HTMLTableElement, cellMinWidth: number, overrideCol?: number, overrideValue?: number): void;
293
+ declare class TableView implements NodeView {
294
+ node: Node$1;
295
+ cellMinWidth: number;
296
+ dom: HTMLDivElement;
297
+ table: HTMLTableElement;
298
+ colgroup: HTMLTableColElement;
299
+ contentDOM: HTMLTableSectionElement;
300
+ constructor(node: Node$1, cellMinWidth: number);
301
+ update(node: Node$1): boolean;
302
+ ignoreMutation(mutation: ViewMutationRecord): boolean;
303
+ }
304
+
305
+ export { type ColGroup, Table, TableCell, type TableCellOptions, TableHeader, type TableHeaderOptions, TableKit, type TableKitOptions, type TableOptions, TableRow, type TableRowOptions, TableView, createColGroup, createTable, updateColumns };