@tiptap/extension-table-cell 2.11.7 → 3.0.0-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.
- package/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +32 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +9 -48
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/src/index.ts +3 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.umd.js +0 -57
- package/dist/index.umd.js.map +0 -1
- package/dist/table-cell.d.ts +0 -15
- package/dist/table-cell.d.ts.map +0 -1
- package/src/table-cell.ts +0 -63
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Tiptap GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# @tiptap/extension-table-cell
|
|
2
|
+
|
|
2
3
|
[](https://www.npmjs.com/package/@tiptap/extension-table-cell)
|
|
3
4
|
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
|
4
5
|
[](https://www.npmjs.com/package/@tiptap/extension-table-cell)
|
|
5
6
|
[](https://github.com/sponsors/ueberdosis)
|
|
6
7
|
|
|
7
8
|
## Introduction
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as _New York Times_, _The Guardian_ or _Atlassian_.
|
|
9
11
|
|
|
10
12
|
## Official Documentation
|
|
13
|
+
|
|
11
14
|
Documentation can be found on the [Tiptap website](https://tiptap.dev).
|
|
12
15
|
|
|
13
16
|
## License
|
|
17
|
+
|
|
14
18
|
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
package/dist/index.cjs
CHANGED
|
@@ -1,53 +1,34 @@
|
|
|
1
|
-
|
|
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);
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* This extension allows you to create table cells.
|
|
9
|
-
* @see https://www.tiptap.dev/api/nodes/table-cell
|
|
10
|
-
*/
|
|
11
|
-
const TableCell = core.Node.create({
|
|
12
|
-
name: 'tableCell',
|
|
13
|
-
addOptions() {
|
|
14
|
-
return {
|
|
15
|
-
HTMLAttributes: {},
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
content: 'block+',
|
|
19
|
-
addAttributes() {
|
|
20
|
-
return {
|
|
21
|
-
colspan: {
|
|
22
|
-
default: 1,
|
|
23
|
-
},
|
|
24
|
-
rowspan: {
|
|
25
|
-
default: 1,
|
|
26
|
-
},
|
|
27
|
-
colwidth: {
|
|
28
|
-
default: null,
|
|
29
|
-
parseHTML: element => {
|
|
30
|
-
const colwidth = element.getAttribute('colwidth');
|
|
31
|
-
const value = colwidth
|
|
32
|
-
? colwidth.split(',').map(width => parseInt(width, 10))
|
|
33
|
-
: null;
|
|
34
|
-
return value;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
tableRole: 'cell',
|
|
40
|
-
isolating: true,
|
|
41
|
-
parseHTML() {
|
|
42
|
-
return [
|
|
43
|
-
{ tag: 'td' },
|
|
44
|
-
];
|
|
45
|
-
},
|
|
46
|
-
renderHTML({ HTMLAttributes }) {
|
|
47
|
-
return ['td', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
48
|
-
},
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
TableCell: () => import_extension_table2.TableCell,
|
|
24
|
+
default: () => index_default
|
|
49
25
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
var import_extension_table = require("@tiptap/extension-table");
|
|
28
|
+
var import_extension_table2 = require("@tiptap/extension-table");
|
|
29
|
+
var index_default = import_extension_table.TableCell;
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
TableCell
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { TableCell } from '@tiptap/extension-table'\n\nexport type { TableCellOptions } from '@tiptap/extension-table'\nexport { TableCell } from '@tiptap/extension-table'\n\nexport default TableCell\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA0B;AAG1B,IAAAA,0BAA0B;AAE1B,IAAO,gBAAQ;","names":["import_extension_table"]}
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { TableCell } from '
|
|
2
|
-
export
|
|
3
|
-
export default TableCell;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { TableCell } from '@tiptap/extension-table';
|
|
2
|
+
export { TableCell, TableCellOptions, TableCell as default } from '@tiptap/extension-table';
|
package/dist/index.js
CHANGED
|
@@ -1,48 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
HTMLAttributes: {},
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
content: 'block+',
|
|
15
|
-
addAttributes() {
|
|
16
|
-
return {
|
|
17
|
-
colspan: {
|
|
18
|
-
default: 1,
|
|
19
|
-
},
|
|
20
|
-
rowspan: {
|
|
21
|
-
default: 1,
|
|
22
|
-
},
|
|
23
|
-
colwidth: {
|
|
24
|
-
default: null,
|
|
25
|
-
parseHTML: element => {
|
|
26
|
-
const colwidth = element.getAttribute('colwidth');
|
|
27
|
-
const value = colwidth
|
|
28
|
-
? colwidth.split(',').map(width => parseInt(width, 10))
|
|
29
|
-
: null;
|
|
30
|
-
return value;
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
tableRole: 'cell',
|
|
36
|
-
isolating: true,
|
|
37
|
-
parseHTML() {
|
|
38
|
-
return [
|
|
39
|
-
{ tag: 'td' },
|
|
40
|
-
];
|
|
41
|
-
},
|
|
42
|
-
renderHTML({ HTMLAttributes }) {
|
|
43
|
-
return ['td', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export { TableCell, TableCell as default };
|
|
48
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { TableCell } from "@tiptap/extension-table";
|
|
3
|
+
import { TableCell as TableCell2 } from "@tiptap/extension-table";
|
|
4
|
+
var index_default = TableCell;
|
|
5
|
+
export {
|
|
6
|
+
TableCell2 as TableCell,
|
|
7
|
+
index_default as default
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { TableCell } from '@tiptap/extension-table'\n\nexport type { TableCellOptions } from '@tiptap/extension-table'\nexport { TableCell } from '@tiptap/extension-table'\n\nexport default TableCell\n"],"mappings":";AAAA,SAAS,iBAAiB;AAG1B,SAAS,aAAAA,kBAAiB;AAE1B,IAAO,gBAAQ;","names":["TableCell"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-table-cell",
|
|
3
3
|
"description": "table cell extension for tiptap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-beta.0",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,24 +15,26 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types":
|
|
18
|
+
"types": {
|
|
19
|
+
"import": "./dist/index.d.ts",
|
|
20
|
+
"require": "./dist/index.d.cts"
|
|
21
|
+
},
|
|
19
22
|
"import": "./dist/index.js",
|
|
20
23
|
"require": "./dist/index.cjs"
|
|
21
24
|
}
|
|
22
25
|
},
|
|
23
26
|
"main": "dist/index.cjs",
|
|
24
27
|
"module": "dist/index.js",
|
|
25
|
-
"umd": "dist/index.umd.js",
|
|
26
28
|
"types": "dist/index.d.ts",
|
|
27
29
|
"files": [
|
|
28
30
|
"src",
|
|
29
31
|
"dist"
|
|
30
32
|
],
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@tiptap/
|
|
34
|
+
"@tiptap/extension-table": "^3.0.0-beta.0"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
|
-
"@tiptap/
|
|
37
|
+
"@tiptap/extension-table": "^3.0.0-beta.0"
|
|
36
38
|
},
|
|
37
39
|
"repository": {
|
|
38
40
|
"type": "git",
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
"directory": "packages/extension-table-cell"
|
|
41
43
|
},
|
|
42
44
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { TableCell } from '
|
|
1
|
+
import { TableCell } from '@tiptap/extension-table'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type { TableCellOptions } from '@tiptap/extension-table'
|
|
4
|
+
export { TableCell } from '@tiptap/extension-table'
|
|
4
5
|
|
|
5
6
|
export default TableCell
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,cAAc,iBAAiB,CAAA;AAE/B,eAAe,SAAS,CAAA"}
|
package/dist/index.umd.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-table-cell"] = {}, global.core));
|
|
5
|
-
})(this, (function (exports, core) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This extension allows you to create table cells.
|
|
9
|
-
* @see https://www.tiptap.dev/api/nodes/table-cell
|
|
10
|
-
*/
|
|
11
|
-
const TableCell = core.Node.create({
|
|
12
|
-
name: 'tableCell',
|
|
13
|
-
addOptions() {
|
|
14
|
-
return {
|
|
15
|
-
HTMLAttributes: {},
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
content: 'block+',
|
|
19
|
-
addAttributes() {
|
|
20
|
-
return {
|
|
21
|
-
colspan: {
|
|
22
|
-
default: 1,
|
|
23
|
-
},
|
|
24
|
-
rowspan: {
|
|
25
|
-
default: 1,
|
|
26
|
-
},
|
|
27
|
-
colwidth: {
|
|
28
|
-
default: null,
|
|
29
|
-
parseHTML: element => {
|
|
30
|
-
const colwidth = element.getAttribute('colwidth');
|
|
31
|
-
const value = colwidth
|
|
32
|
-
? colwidth.split(',').map(width => parseInt(width, 10))
|
|
33
|
-
: null;
|
|
34
|
-
return value;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
tableRole: 'cell',
|
|
40
|
-
isolating: true,
|
|
41
|
-
parseHTML() {
|
|
42
|
-
return [
|
|
43
|
-
{ tag: 'td' },
|
|
44
|
-
];
|
|
45
|
-
},
|
|
46
|
-
renderHTML({ HTMLAttributes }) {
|
|
47
|
-
return ['td', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
exports.TableCell = TableCell;
|
|
52
|
-
exports.default = TableCell;
|
|
53
|
-
|
|
54
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
-
|
|
56
|
-
}));
|
|
57
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/table-cell.ts"],"sourcesContent":["import { 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\n ? colwidth.split(',').map(width => parseInt(width, 10))\n : null\n\n return value\n },\n },\n }\n },\n\n tableRole: 'cell',\n\n isolating: true,\n\n parseHTML() {\n return [\n { tag: 'td' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['td', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n})\n"],"names":["Node","mergeAttributes"],"mappings":";;;;;;EAWA;;;EAGG;AACU,QAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;EACrD,IAAA,IAAI,EAAE,WAAW;MAEjB,UAAU,GAAA;UACR,OAAO;EACL,YAAA,cAAc,EAAE,EAAE;WACnB;OACF;EAED,IAAA,OAAO,EAAE,QAAQ;MAEjB,aAAa,GAAA;UACX,OAAO;EACL,YAAA,OAAO,EAAE;EACP,gBAAA,OAAO,EAAE,CAAC;EACX,aAAA;EACD,YAAA,OAAO,EAAE;EACP,gBAAA,OAAO,EAAE,CAAC;EACX,aAAA;EACD,YAAA,QAAQ,EAAE;EACR,gBAAA,OAAO,EAAE,IAAI;kBACb,SAAS,EAAE,OAAO,IAAG;sBACnB,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC;sBACjD,MAAM,KAAK,GAAG;4BACV,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;4BACpD,IAAI;EAER,oBAAA,OAAO,KAAK;mBACb;EACF,aAAA;WACF;OACF;EAED,IAAA,SAAS,EAAE,MAAM;EAEjB,IAAA,SAAS,EAAE,IAAI;MAEf,SAAS,GAAA;UACP,OAAO;cACL,EAAE,GAAG,EAAE,IAAI,EAAE;WACd;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;EAC3B,QAAA,OAAO,CAAC,IAAI,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;OAC/E;EAEF,CAAA;;;;;;;;;;;"}
|
package/dist/table-cell.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Node } from '@tiptap/core';
|
|
2
|
-
export interface TableCellOptions {
|
|
3
|
-
/**
|
|
4
|
-
* The HTML attributes for a table cell node.
|
|
5
|
-
* @default {}
|
|
6
|
-
* @example { class: 'foo' }
|
|
7
|
-
*/
|
|
8
|
-
HTMLAttributes: Record<string, any>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* This extension allows you to create table cells.
|
|
12
|
-
* @see https://www.tiptap.dev/api/nodes/table-cell
|
|
13
|
-
*/
|
|
14
|
-
export declare const TableCell: Node<TableCellOptions, any>;
|
|
15
|
-
//# sourceMappingURL=table-cell.d.ts.map
|
package/dist/table-cell.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-cell.d.ts","sourceRoot":"","sources":["../src/table-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,cAAc,CAAA;AAEpD,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,6BA+CpB,CAAA"}
|
package/src/table-cell.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { mergeAttributes, Node } from '@tiptap/core'
|
|
2
|
-
|
|
3
|
-
export interface TableCellOptions {
|
|
4
|
-
/**
|
|
5
|
-
* The HTML attributes for a table cell node.
|
|
6
|
-
* @default {}
|
|
7
|
-
* @example { class: 'foo' }
|
|
8
|
-
*/
|
|
9
|
-
HTMLAttributes: Record<string, any>,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* This extension allows you to create table cells.
|
|
14
|
-
* @see https://www.tiptap.dev/api/nodes/table-cell
|
|
15
|
-
*/
|
|
16
|
-
export const TableCell = Node.create<TableCellOptions>({
|
|
17
|
-
name: 'tableCell',
|
|
18
|
-
|
|
19
|
-
addOptions() {
|
|
20
|
-
return {
|
|
21
|
-
HTMLAttributes: {},
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
content: 'block+',
|
|
26
|
-
|
|
27
|
-
addAttributes() {
|
|
28
|
-
return {
|
|
29
|
-
colspan: {
|
|
30
|
-
default: 1,
|
|
31
|
-
},
|
|
32
|
-
rowspan: {
|
|
33
|
-
default: 1,
|
|
34
|
-
},
|
|
35
|
-
colwidth: {
|
|
36
|
-
default: null,
|
|
37
|
-
parseHTML: element => {
|
|
38
|
-
const colwidth = element.getAttribute('colwidth')
|
|
39
|
-
const value = colwidth
|
|
40
|
-
? colwidth.split(',').map(width => parseInt(width, 10))
|
|
41
|
-
: null
|
|
42
|
-
|
|
43
|
-
return value
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
tableRole: 'cell',
|
|
50
|
-
|
|
51
|
-
isolating: true,
|
|
52
|
-
|
|
53
|
-
parseHTML() {
|
|
54
|
-
return [
|
|
55
|
-
{ tag: 'td' },
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
renderHTML({ HTMLAttributes }) {
|
|
60
|
-
return ['td', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
})
|