feat(richtext-lexical): export serialized inline blocks and table node types

This commit is contained in:
Alessio Gravili
2024-08-06 11:42:09 -04:00
parent c15d679b65
commit ffd8ea516d
2 changed files with 37 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
import type {
SerializedTableCellNode as _SerializedTableCellNode,
SerializedTableNode as _SerializedTableNode,
SerializedTableRowNode as _SerializedTableRowNode,
} from '@lexical/table'
import type { Spread } from 'lexical'
import type { Config, Field } from 'payload'
import { TableCellNode, TableNode, TableRowNode } from '@lexical/table'
@@ -23,6 +29,27 @@ const fields: Field[] = [
required: true,
},
]
export type SerializedTableCellNode = Spread<
{
type: 'tablecell'
},
_SerializedTableCellNode
>
export type SerializedTableNode = Spread<
{
type: 'table'
},
_SerializedTableNode
>
export type SerializedTableRowNode = Spread<
{
type: 'tablerow'
},
_SerializedTableRowNode
>
export const EXPERIMENTAL_TableFeature = createServerFeature({
feature: async ({ config, isRoot }) => {
const validRelationships = config.collections.map((c) => c.slug) || []

View File

@@ -9,6 +9,12 @@ import type {
import type { SerializedQuoteNode } from './features/blockquote/feature.server.js'
import type { SerializedBlockNode } from './features/blocks/nodes/BlocksNode.js'
import type { SerializedInlineBlockNode } from './features/blocks/nodes/InlineBlocksNode.js'
import type {
SerializedTableCellNode,
SerializedTableNode,
SerializedTableRowNode,
} from './features/experimental_table/feature.server.js'
import type { SerializedHeadingNode } from './features/heading/feature.server.js'
import type { SerializedHorizontalRuleNode } from './features/horizontalRule/nodes/HorizontalRuleNode.js'
import type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link/nodes/types.js'
@@ -21,11 +27,15 @@ export type {
SerializedBlockNode,
SerializedHeadingNode,
SerializedHorizontalRuleNode,
SerializedInlineBlockNode,
SerializedLinkNode,
SerializedListItemNode,
SerializedListNode,
SerializedQuoteNode,
SerializedRelationshipNode,
SerializedTableCellNode,
SerializedTableNode,
SerializedTableRowNode,
SerializedUploadNode,
}