Skip to content

Commit 1c8bed5

Browse files
committed
feat(richtext-lexical): add missing SerializedLineBreakNode to default node types, remove SerializedBlockNode from default node types
1 parent 10336ba commit 1c8bed5

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

packages/richtext-lexical/src/nodeTypes.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import type {
2+
SerializedLineBreakNode as _SerializedLineBreakNode,
3+
SerializedTextNode as _SerializedTextNode,
24
SerializedEditorState,
35
SerializedElementNode,
46
SerializedLexicalNode,
57
Spread,
6-
TextModeType,
78
} from 'lexical'
89

910
import type { SerializedQuoteNode } from './features/blockquote/feature.server.js'
@@ -39,14 +40,17 @@ export type SerializedParagraphNode<T extends SerializedLexicalNode = Serialized
3940
export type SerializedTextNode = Spread<
4041
{
4142
children?: never // required so that our typed editor state doesn't automatically add children
42-
detail: number
43-
format: number
44-
mode: TextModeType
45-
style: string
46-
text: string
4743
type: 'text'
4844
},
49-
SerializedLexicalNode
45+
_SerializedTextNode
46+
>
47+
48+
export type SerializedLineBreakNode = Spread<
49+
{
50+
children?: never // required so that our typed editor state doesn't automatically add children
51+
type: 'linebreak'
52+
},
53+
_SerializedLineBreakNode
5054
>
5155

5256
type RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4> = Depth extends 0
@@ -60,9 +64,10 @@ export type TypedEditorState<T extends SerializedLexicalNode = SerializedLexical
6064

6165
export type DefaultNodeTypes =
6266
| SerializedAutoLinkNode
63-
| SerializedBlockNode
67+
//| SerializedBlockNode // Not included by default
6468
| SerializedHeadingNode
6569
| SerializedHorizontalRuleNode
70+
| SerializedLineBreakNode
6671
| SerializedLinkNode
6772
| SerializedListItemNode
6873
| SerializedListNode

0 commit comments

Comments
 (0)