-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(table): make all table packages be in one package, add a new Tab…
…leKit extension to configure them (#5469) * feat(table): make all table packages be in one package, add a new TableKit extension to configure them * chore: changeset management * chore: put changesets back
- Loading branch information
1 parent
e5f1342
commit 131c7d0
Showing
32 changed files
with
122 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@tiptap/extension-table-header": minor | ||
"@tiptap/extension-table-cell": minor | ||
"@tiptap/extension-table-row": minor | ||
"@tiptap/extension-table": minor | ||
--- | ||
|
||
This change repackages all of the table extensions to be within the `@tiptap/extension-table` package (other packages are just a re-export of the `@tiptap/extension-table` package). It also adds the `TableKit` export which will allow configuring the entire table with one extension. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { TableCell } from './table-cell.js' | ||
import { TableCell } from '@tiptap/extension-table' | ||
|
||
export * from './table-cell.js' | ||
export { TableCell, TableCellOptions } from '@tiptap/extension-table' | ||
|
||
export default TableCell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { TableHeader } from './table-header.js' | ||
import { TableHeader } from '@tiptap/extension-table' | ||
|
||
export * from './table-header.js' | ||
export { TableHeader, TableHeaderOptions } from '@tiptap/extension-table' | ||
|
||
export default TableHeader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { TableRow } from './table-row.js' | ||
import { TableRow } from '@tiptap/extension-table' | ||
|
||
export * from './table-row.js' | ||
export { TableRow, TableRowOptions } from '@tiptap/extension-table' | ||
|
||
export default TableRow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import { Table } from './table.js' | ||
|
||
export * from './table.js' | ||
export * from './utilities/createColGroup.js' | ||
export * from './utilities/createTable.js' | ||
|
||
export default Table | ||
export * from './table/index.js' | ||
export * from './table-cell/index.js' | ||
export * from './table-header/index.js' | ||
export * from './table-kit.js' | ||
export * from './table-row/index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './table-cell.js' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './table-header.js' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Extension } from '@tiptap/core' | ||
|
||
import { Table, TableOptions } from './table/index.js' | ||
import { TableCell, TableCellOptions } from './table-cell/index.js' | ||
import { TableHeader, TableHeaderOptions } from './table-header/index.js' | ||
import { TableRow, TableRowOptions } from './table-row/index.js' | ||
|
||
export interface TableKitOptions { | ||
/** | ||
* If set to false, the table extension will not be registered | ||
* @example table: false | ||
*/ | ||
table: Partial<TableOptions> | false, | ||
/** | ||
* If set to false, the table extension will not be registered | ||
* @example tableCell: false | ||
*/ | ||
tableCell: Partial<TableCellOptions> | false, | ||
/** | ||
* If set to false, the table extension will not be registered | ||
* @example tableHeader: false | ||
*/ | ||
tableHeader: Partial<TableHeaderOptions> | false, | ||
/** | ||
* If set to false, the table extension will not be registered | ||
* @example tableRow: false | ||
*/ | ||
tableRow: Partial<TableRowOptions> | false, | ||
} | ||
|
||
/** | ||
* The table kit is a collection of table editor extensions. | ||
* | ||
* It’s a good starting point for building your own table in Tiptap. | ||
*/ | ||
export const TableKit = Extension.create<TableKitOptions>({ | ||
name: 'tableKit', | ||
|
||
addExtensions() { | ||
const extensions = [] | ||
|
||
if (this.options.table !== false) { | ||
extensions.push(Table.configure(this.options.table)) | ||
} | ||
|
||
if (this.options.tableCell !== false) { | ||
extensions.push(TableCell.configure(this.options.tableCell)) | ||
} | ||
|
||
if (this.options.tableHeader !== false) { | ||
extensions.push(TableHeader.configure(this.options.tableHeader)) | ||
} | ||
|
||
if (this.options.tableRow !== false) { | ||
extensions.push(TableRow.configure(this.options.tableRow)) | ||
} | ||
|
||
return extensions | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './table-row.js' |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './table.js' | ||
export * from './utilities/createColGroup.js' | ||
export * from './utilities/createTable.js' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.