Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanJablo committed Dec 19, 2024
1 parent a42415c commit 83f9a79
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
2 changes: 0 additions & 2 deletions packages/lexical-table/src/LexicalTableNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ export class TableNode extends ElementNode {
...super.exportJSON(),
colWidths: this.getColWidths(),
rowStriping: this.__rowStriping ? this.__rowStriping : undefined,
type: 'table',
version: 1,
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/lexical-table/src/LexicalTableRowNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ export class TableRowNode extends ElementNode {
return {
...super.exportJSON(),
...(this.getHeight() && {height: this.getHeight()}),
type: 'tablerow',
version: 1,
};
}

Expand Down
12 changes: 2 additions & 10 deletions packages/lexical-website/docs/concepts/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const jsonString = JSON.stringify(editorState);

#### `LexicalNode.exportJSON()`

You can control how a `LexicalNode` is represented as JSON by adding an `exportJSON()` method. It's important to ensure your serialized JSON node has a `type` field and a `children` field if it's an `ElementNode`.
You can control how a `LexicalNode` is represented as JSON by adding an `exportJSON()` method. It's important that you extend the serialization of the superclass by invoking `super`: e.g. `{ ...super.exportJSON(), /* your other properties */ }`.

```js
export type SerializedLexicalNode = {
Expand All @@ -197,8 +197,6 @@ exportJSON(): SerializedHeadingNode {
return {
...super.exportJSON(),
tag: this.getTag(),
type: 'heading',
version: 1,
};
}
```
Expand Down Expand Up @@ -373,13 +371,7 @@ export class ExtendedTextNode extends TextNode {
return this.__type === 'extended-text' && this.__mode === 0;
}

exportJSON(): SerializedTextNode {
return {
...super.exportJSON(),
type: 'extended-text',
version: 1,
}
}
// no need to add exportJSON here, since we are not adding any new properties
}

export function $createExtendedTextNode(text: string): ExtendedTextNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export class EmojiNode extends TextNode {
exportJSON(): SerializedEmojiNode {
return {
...super.exportJSON(),
type: 'emoji',
unifiedID: this.__unifiedID,
};
}
Expand Down

0 comments on commit 83f9a79

Please sign in to comment.