@tiptap/extension-table 3.0.0 → 3.0.2
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.
- package/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/cell/index.cjs +68 -0
- package/dist/cell/index.cjs.map +1 -0
- package/dist/cell/index.d.cts +33 -0
- package/dist/cell/index.d.ts +33 -0
- package/dist/cell/index.js +41 -0
- package/dist/cell/index.js.map +1 -0
- package/dist/header/index.cjs +68 -0
- package/dist/header/index.cjs.map +1 -0
- package/dist/header/index.d.cts +33 -0
- package/dist/header/index.d.ts +33 -0
- package/dist/header/index.js +41 -0
- package/dist/header/index.js.map +1 -0
- package/dist/index.cjs +480 -321
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +305 -0
- package/dist/index.d.ts +305 -0
- package/dist/index.js +465 -316
- package/dist/index.js.map +1 -1
- package/dist/kit/index.cjs +497 -0
- package/dist/kit/index.cjs.map +1 -0
- package/dist/kit/index.d.cts +252 -0
- package/dist/kit/index.d.ts +252 -0
- package/dist/kit/index.js +490 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/row/index.cjs +49 -0
- package/dist/row/index.cjs.map +1 -0
- package/dist/row/index.d.cts +33 -0
- package/dist/row/index.d.ts +33 -0
- package/dist/row/index.js +22 -0
- package/dist/row/index.js.map +1 -0
- package/dist/table/index.cjs +384 -0
- package/dist/table/index.cjs.map +1 -0
- package/dist/{packages/extension-table/src/table.d.ts → table/index.d.cts} +45 -19
- package/dist/table/index.d.ts +220 -0
- package/dist/table/index.js +373 -0
- package/dist/table/index.js.map +1 -0
- package/package.json +53 -11
- package/src/cell/index.ts +1 -0
- package/src/cell/table-cell.ts +60 -0
- package/src/header/index.ts +1 -0
- package/src/header/table-header.ts +60 -0
- package/src/index.ts +6 -7
- package/src/kit/index.ts +64 -0
- package/src/row/index.ts +1 -0
- package/src/row/table-row.ts +38 -0
- package/src/table/TableView.ts +108 -0
- package/src/table/index.ts +3 -0
- package/src/{table.ts → table/table.ts} +56 -64
- package/src/table/utilities/colStyle.ts +9 -0
- package/src/{utilities → table/utilities}/createCell.ts +1 -1
- package/src/{utilities → table/utilities}/createColGroup.ts +24 -6
- package/src/{utilities → table/utilities}/createTable.ts +1 -1
- package/src/{utilities → table/utilities}/deleteTableWhenAllCellsSelected.ts +2 -1
- package/src/{utilities → table/utilities}/getTableNodeTypes.ts +1 -1
- package/src/types.ts +19 -0
- package/dist/index.umd.js +0 -358
- package/dist/index.umd.js.map +0 -1
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -161
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -343
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -451
- package/dist/packages/core/src/Node.d.ts +0 -611
- package/dist/packages/core/src/NodePos.d.ts +0 -44
- package/dist/packages/core/src/NodeView.d.ts +0 -31
- package/dist/packages/core/src/PasteRule.d.ts +0 -50
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
- package/dist/packages/core/src/commands/command.d.ts +0 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
- package/dist/packages/core/src/commands/cut.d.ts +0 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
- package/dist/packages/core/src/commands/enter.d.ts +0 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
- package/dist/packages/core/src/commands/first.d.ts +0 -14
- package/dist/packages/core/src/commands/focus.d.ts +0 -27
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/index.d.ts +0 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
- package/dist/packages/core/src/commands/join.d.ts +0 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
- package/dist/packages/core/src/commands/lift.d.ts +0 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
- package/dist/packages/core/src/commands/setContent.d.ts +0 -40
- package/dist/packages/core/src/commands/setMark.d.ts +0 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
- package/dist/packages/core/src/commands/setNode.d.ts +0 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
- package/dist/packages/core/src/extensions/commands.d.ts +0 -3
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getText.d.ts +0 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
- package/dist/packages/core/src/helpers/index.d.ts +0 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -24
- package/dist/packages/core/src/inputRules/index.d.ts +0 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -255
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/index.d.ts +0 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-table/src/TableView.d.ts +0 -17
- package/dist/packages/extension-table/src/index.d.ts +0 -5
- package/dist/packages/extension-table/src/utilities/createCell.d.ts +0 -2
- package/dist/packages/extension-table/src/utilities/createColGroup.d.ts +0 -19
- package/dist/packages/extension-table/src/utilities/createTable.d.ts +0 -2
- package/dist/packages/extension-table/src/utilities/deleteTableWhenAllCellsSelected.d.ts +0 -2
- package/dist/packages/extension-table/src/utilities/getTableNodeTypes.d.ts +0 -4
- package/dist/packages/extension-table/src/utilities/isCellSelection.d.ts +0 -2
- package/src/TableView.ts +0 -100
- /package/src/{utilities → table/utilities}/isCellSelection.ts +0 -0
package/dist/index.d.ts
ADDED
|
@@ -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 };
|