@tiptap/extension-table 3.20.2 → 3.20.3
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/package.json +5 -5
- package/dist/cell/index.cjs +0 -77
- package/dist/cell/index.cjs.map +0 -1
- package/dist/cell/index.d.cts +0 -33
- package/dist/cell/index.d.ts +0 -33
- package/dist/cell/index.js +0 -50
- package/dist/cell/index.js.map +0 -1
- package/dist/header/index.cjs +0 -68
- package/dist/header/index.cjs.map +0 -1
- package/dist/header/index.d.cts +0 -33
- package/dist/header/index.d.ts +0 -33
- package/dist/header/index.js +0 -41
- package/dist/header/index.js.map +0 -1
- package/dist/index.cjs +0 -637
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -317
- package/dist/index.d.ts +0 -317
- package/dist/index.js +0 -623
- package/dist/index.js.map +0 -1
- package/dist/kit/index.cjs +0 -615
- package/dist/kit/index.cjs.map +0 -1
- package/dist/kit/index.d.cts +0 -259
- package/dist/kit/index.d.ts +0 -259
- package/dist/kit/index.js +0 -613
- package/dist/kit/index.js.map +0 -1
- package/dist/row/index.cjs +0 -49
- package/dist/row/index.cjs.map +0 -1
- package/dist/row/index.d.cts +0 -33
- package/dist/row/index.d.ts +0 -33
- package/dist/row/index.js +0 -22
- package/dist/row/index.js.map +0 -1
- package/dist/table/index.cjs +0 -497
- package/dist/table/index.cjs.map +0 -1
- package/dist/table/index.d.cts +0 -232
- package/dist/table/index.d.ts +0 -232
- package/dist/table/index.js +0 -489
- package/dist/table/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-table",
|
|
3
3
|
"description": "table extension for tiptap",
|
|
4
|
-
"version": "3.20.
|
|
4
|
+
"version": "3.20.3",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"dist"
|
|
72
72
|
],
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@tiptap/core": "^3.20.
|
|
75
|
-
"@tiptap/pm": "^3.20.
|
|
74
|
+
"@tiptap/core": "^3.20.3",
|
|
75
|
+
"@tiptap/pm": "^3.20.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@tiptap/core": "^3.20.
|
|
79
|
-
"@tiptap/pm": "^3.20.
|
|
78
|
+
"@tiptap/core": "^3.20.3",
|
|
79
|
+
"@tiptap/pm": "^3.20.3"
|
|
80
80
|
},
|
|
81
81
|
"repository": {
|
|
82
82
|
"type": "git",
|
package/dist/cell/index.cjs
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/cell/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
TableCell: () => TableCell
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
|
|
27
|
-
// src/cell/table-cell.ts
|
|
28
|
-
var import_core = require("@tiptap/core");
|
|
29
|
-
var TableCell = import_core.Node.create({
|
|
30
|
-
name: "tableCell",
|
|
31
|
-
addOptions() {
|
|
32
|
-
return {
|
|
33
|
-
HTMLAttributes: {}
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
content: "block+",
|
|
37
|
-
addAttributes() {
|
|
38
|
-
return {
|
|
39
|
-
colspan: {
|
|
40
|
-
default: 1
|
|
41
|
-
},
|
|
42
|
-
rowspan: {
|
|
43
|
-
default: 1
|
|
44
|
-
},
|
|
45
|
-
colwidth: {
|
|
46
|
-
default: null,
|
|
47
|
-
parseHTML: (element) => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
const colwidth = element.getAttribute("colwidth");
|
|
50
|
-
const value = colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
|
|
51
|
-
if (!value) {
|
|
52
|
-
const cols = (_a = element.closest("table")) == null ? void 0 : _a.querySelectorAll("colgroup > col");
|
|
53
|
-
const cellIndex = Array.from(((_b = element.parentElement) == null ? void 0 : _b.children) || []).indexOf(element);
|
|
54
|
-
if (cellIndex && cellIndex > -1 && cols && cols[cellIndex]) {
|
|
55
|
-
const colWidth = cols[cellIndex].getAttribute("width");
|
|
56
|
-
return colWidth ? [parseInt(colWidth, 10)] : null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return value;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
tableRole: "cell",
|
|
65
|
-
isolating: true,
|
|
66
|
-
parseHTML() {
|
|
67
|
-
return [{ tag: "td" }];
|
|
68
|
-
},
|
|
69
|
-
renderHTML({ HTMLAttributes }) {
|
|
70
|
-
return ["td", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
-
0 && (module.exports = {
|
|
75
|
-
TableCell
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/cell/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cell/index.ts","../../src/cell/table-cell.ts"],"sourcesContent":["export * from './table-cell.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 // if there is no colwidth attribute on the cell, try to get it from the colgroup\n if (!value) {\n const cols = element.closest('table')?.querySelectorAll('colgroup > col')\n const cellIndex = Array.from(element.parentElement?.children || []).indexOf(element)\n\n if (cellIndex && cellIndex > -1 && cols && cols[cellIndex]) {\n const colWidth = cols[cellIndex].getAttribute('width')\n return colWidth ? [parseInt(colWidth, 10)] : null\n }\n }\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,kBAAsC;AAe/B,IAAM,YAAY,iBAAK,OAAyB;AAAA,EACrD,MA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face NodeConfig<Options, Storage> {
|
|
5
|
-
/**
|
|
6
|
-
* A string or function to determine the role of the table.
|
|
7
|
-
* @default 'table'
|
|
8
|
-
* @example () => 'table'
|
|
9
|
-
*/
|
|
10
|
-
tableRole?: string | ((this: {
|
|
11
|
-
name: string;
|
|
12
|
-
options: Options;
|
|
13
|
-
storage: Storage;
|
|
14
|
-
parent: ParentConfig<NodeConfig<Options>>['tableRole'];
|
|
15
|
-
}) => string);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface TableCellOptions {
|
|
20
|
-
/**
|
|
21
|
-
* The HTML attributes for a table cell node.
|
|
22
|
-
* @default {}
|
|
23
|
-
* @example { class: 'foo' }
|
|
24
|
-
*/
|
|
25
|
-
HTMLAttributes: Record<string, any>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* This extension allows you to create table cells.
|
|
29
|
-
* @see https://www.tiptap.dev/api/nodes/table-cell
|
|
30
|
-
*/
|
|
31
|
-
declare const TableCell: Node<TableCellOptions, any>;
|
|
32
|
-
|
|
33
|
-
export { TableCell, type TableCellOptions };
|
package/dist/cell/index.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ParentConfig, Node } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
declare module '@tiptap/core' {
|
|
4
|
-
interface NodeConfig<Options, Storage> {
|
|
5
|
-
/**
|
|
6
|
-
* A string or function to determine the role of the table.
|
|
7
|
-
* @default 'table'
|
|
8
|
-
* @example () => 'table'
|
|
9
|
-
*/
|
|
10
|
-
tableRole?: string | ((this: {
|
|
11
|
-
name: string;
|
|
12
|
-
options: Options;
|
|
13
|
-
storage: Storage;
|
|
14
|
-
parent: ParentConfig<NodeConfig<Options>>['tableRole'];
|
|
15
|
-
}) => string);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface TableCellOptions {
|
|
20
|
-
/**
|
|
21
|
-
* The HTML attributes for a table cell node.
|
|
22
|
-
* @default {}
|
|
23
|
-
* @example { class: 'foo' }
|
|
24
|
-
*/
|
|
25
|
-
HTMLAttributes: Record<string, any>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* This extension allows you to create table cells.
|
|
29
|
-
* @see https://www.tiptap.dev/api/nodes/table-cell
|
|
30
|
-
*/
|
|
31
|
-
declare const TableCell: Node<TableCellOptions, any>;
|
|
32
|
-
|
|
33
|
-
export { TableCell, type TableCellOptions };
|
package/dist/cell/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// src/cell/table-cell.ts
|
|
2
|
-
import { mergeAttributes, Node } from "@tiptap/core";
|
|
3
|
-
var TableCell = Node.create({
|
|
4
|
-
name: "tableCell",
|
|
5
|
-
addOptions() {
|
|
6
|
-
return {
|
|
7
|
-
HTMLAttributes: {}
|
|
8
|
-
};
|
|
9
|
-
},
|
|
10
|
-
content: "block+",
|
|
11
|
-
addAttributes() {
|
|
12
|
-
return {
|
|
13
|
-
colspan: {
|
|
14
|
-
default: 1
|
|
15
|
-
},
|
|
16
|
-
rowspan: {
|
|
17
|
-
default: 1
|
|
18
|
-
},
|
|
19
|
-
colwidth: {
|
|
20
|
-
default: null,
|
|
21
|
-
parseHTML: (element) => {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
const colwidth = element.getAttribute("colwidth");
|
|
24
|
-
const value = colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
|
|
25
|
-
if (!value) {
|
|
26
|
-
const cols = (_a = element.closest("table")) == null ? void 0 : _a.querySelectorAll("colgroup > col");
|
|
27
|
-
const cellIndex = Array.from(((_b = element.parentElement) == null ? void 0 : _b.children) || []).indexOf(element);
|
|
28
|
-
if (cellIndex && cellIndex > -1 && cols && cols[cellIndex]) {
|
|
29
|
-
const colWidth = cols[cellIndex].getAttribute("width");
|
|
30
|
-
return colWidth ? [parseInt(colWidth, 10)] : null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
tableRole: "cell",
|
|
39
|
-
isolating: true,
|
|
40
|
-
parseHTML() {
|
|
41
|
-
return [{ tag: "td" }];
|
|
42
|
-
},
|
|
43
|
-
renderHTML({ HTMLAttributes }) {
|
|
44
|
-
return ["td", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
export {
|
|
48
|
-
TableCell
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cell/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cell/table-cell.ts"],"sourcesContent":["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 // if there is no colwidth attribute on the cell, try to get it from the colgroup\n if (!value) {\n const cols = element.closest('table')?.querySelectorAll('colgroup > col')\n const cellIndex = Array.from(element.parentElement?.children || []).indexOf(element)\n\n if (cellIndex && cellIndex > -1 && cols && cols[cellIndex]) {\n const colWidth = cols[cellIndex].getAttribute('width')\n return colWidth ? [parseInt(colWidth, 10)] : null\n }\n }\n\n return value\n },\n },\n }\n },\n\n tableRole: 'cell',\n\n isolating: true,\n\n parseHTML() {\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AAG,CAAC;AAAA,EAC/E;AACF,CAAC;","names":[]}
|
package/dist/header/index.cjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/header/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
TableHeader: () => TableHeader
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
|
|
27
|
-
// src/header/table-header.ts
|
|
28
|
-
var import_core = require("@tiptap/core");
|
|
29
|
-
var TableHeader = import_core.Node.create({
|
|
30
|
-
name: "tableHeader",
|
|
31
|
-
addOptions() {
|
|
32
|
-
return {
|
|
33
|
-
HTMLAttributes: {}
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
content: "block+",
|
|
37
|
-
addAttributes() {
|
|
38
|
-
return {
|
|
39
|
-
colspan: {
|
|
40
|
-
default: 1
|
|
41
|
-
},
|
|
42
|
-
rowspan: {
|
|
43
|
-
default: 1
|
|
44
|
-
},
|
|
45
|
-
colwidth: {
|
|
46
|
-
default: null,
|
|
47
|
-
parseHTML: (element) => {
|
|
48
|
-
const colwidth = element.getAttribute("colwidth");
|
|
49
|
-
const value = colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
tableRole: "header_cell",
|
|
56
|
-
isolating: true,
|
|
57
|
-
parseHTML() {
|
|
58
|
-
return [{ tag: "th" }];
|
|
59
|
-
},
|
|
60
|
-
renderHTML({ HTMLAttributes }) {
|
|
61
|
-
return ["th", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
TableHeader
|
|
67
|
-
});
|
|
68
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/header/index.ts","../../src/header/table-header.ts"],"sourcesContent":["export * from './table-header.js'\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,kBAAsC;AAe/B,IAAM,cAAc,iBAAK,OAA2B;AAAA,EACzD,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,IAAI;AAEjF,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW;AAAA,EAEX,WAAW;AAAA,EAEX,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,KAAK,CAAC;AAAA,EACvB;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,UAAM,6BAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAC/E;AACF,CAAC;","names":[]}
|
package/dist/header/index.d.cts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ParentConfig, Node } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
declare module '@tiptap/core' {
|
|
4
|
-
interface NodeConfig<Options, Storage> {
|
|
5
|
-
/**
|
|
6
|
-
* A string or function to determine the role of the table.
|
|
7
|
-
* @default 'table'
|
|
8
|
-
* @example () => 'table'
|
|
9
|
-
*/
|
|
10
|
-
tableRole?: string | ((this: {
|
|
11
|
-
name: string;
|
|
12
|
-
options: Options;
|
|
13
|
-
storage: Storage;
|
|
14
|
-
parent: ParentConfig<NodeConfig<Options>>['tableRole'];
|
|
15
|
-
}) => string);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface TableHeaderOptions {
|
|
20
|
-
/**
|
|
21
|
-
* The HTML attributes for a table header node.
|
|
22
|
-
* @default {}
|
|
23
|
-
* @example { class: 'foo' }
|
|
24
|
-
*/
|
|
25
|
-
HTMLAttributes: Record<string, any>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* This extension allows you to create table headers.
|
|
29
|
-
* @see https://www.tiptap.dev/api/nodes/table-header
|
|
30
|
-
*/
|
|
31
|
-
declare const TableHeader: Node<TableHeaderOptions, any>;
|
|
32
|
-
|
|
33
|
-
export { TableHeader, type TableHeaderOptions };
|
package/dist/header/index.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ParentConfig, Node } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
declare module '@tiptap/core' {
|
|
4
|
-
interface NodeConfig<Options, Storage> {
|
|
5
|
-
/**
|
|
6
|
-
* A string or function to determine the role of the table.
|
|
7
|
-
* @default 'table'
|
|
8
|
-
* @example () => 'table'
|
|
9
|
-
*/
|
|
10
|
-
tableRole?: string | ((this: {
|
|
11
|
-
name: string;
|
|
12
|
-
options: Options;
|
|
13
|
-
storage: Storage;
|
|
14
|
-
parent: ParentConfig<NodeConfig<Options>>['tableRole'];
|
|
15
|
-
}) => string);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface TableHeaderOptions {
|
|
20
|
-
/**
|
|
21
|
-
* The HTML attributes for a table header node.
|
|
22
|
-
* @default {}
|
|
23
|
-
* @example { class: 'foo' }
|
|
24
|
-
*/
|
|
25
|
-
HTMLAttributes: Record<string, any>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* This extension allows you to create table headers.
|
|
29
|
-
* @see https://www.tiptap.dev/api/nodes/table-header
|
|
30
|
-
*/
|
|
31
|
-
declare const TableHeader: Node<TableHeaderOptions, any>;
|
|
32
|
-
|
|
33
|
-
export { TableHeader, type TableHeaderOptions };
|
package/dist/header/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// src/header/table-header.ts
|
|
2
|
-
import { mergeAttributes, Node } from "@tiptap/core";
|
|
3
|
-
var TableHeader = Node.create({
|
|
4
|
-
name: "tableHeader",
|
|
5
|
-
addOptions() {
|
|
6
|
-
return {
|
|
7
|
-
HTMLAttributes: {}
|
|
8
|
-
};
|
|
9
|
-
},
|
|
10
|
-
content: "block+",
|
|
11
|
-
addAttributes() {
|
|
12
|
-
return {
|
|
13
|
-
colspan: {
|
|
14
|
-
default: 1
|
|
15
|
-
},
|
|
16
|
-
rowspan: {
|
|
17
|
-
default: 1
|
|
18
|
-
},
|
|
19
|
-
colwidth: {
|
|
20
|
-
default: null,
|
|
21
|
-
parseHTML: (element) => {
|
|
22
|
-
const colwidth = element.getAttribute("colwidth");
|
|
23
|
-
const value = colwidth ? colwidth.split(",").map((width) => parseInt(width, 10)) : null;
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
tableRole: "header_cell",
|
|
30
|
-
isolating: true,
|
|
31
|
-
parseHTML() {
|
|
32
|
-
return [{ tag: "th" }];
|
|
33
|
-
},
|
|
34
|
-
renderHTML({ HTMLAttributes }) {
|
|
35
|
-
return ["th", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
export {
|
|
39
|
-
TableHeader
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=index.js.map
|
package/dist/header/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/header/table-header.ts"],"sourcesContent":["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"],"mappings":";AAEA,SAAS,iBAAiB,YAAY;AAe/B,IAAM,cAAc,KAAK,OAA2B;AAAA,EACzD,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,IAAI;AAEjF,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW;AAAA,EAEX,WAAW;AAAA,EAEX,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,KAAK,CAAC;AAAA,EACvB;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,MAAM,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAC/E;AACF,CAAC;","names":[]}
|