Skip to content

Commit 703a289

Browse files
committed
chore: fix freezing when pressing Enter after adding an inline link to a Super note [skip e2e]
1 parent e1905fa commit 703a289

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/BubbleNode.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
import { DOMConversionMap, DOMExportOutput, ElementFormatType, LexicalEditor, NodeKey } from 'lexical'
2-
import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'
1+
import { DOMConversionMap, DOMExportOutput, DecoratorNode, LexicalEditor, NodeKey } from 'lexical'
32
import { $createBubbleNode, convertToBubbleElement } from './BubbleUtils'
43
import { BubbleComponent } from './BubbleComponent'
54
import { SerializedBubbleNode } from './SerializedBubbleNode'
65
import { ItemNodeInterface } from '../../ItemNodeInterface'
76

8-
export class BubbleNode extends DecoratorBlockNode implements ItemNodeInterface {
7+
export class BubbleNode extends DecoratorNode<JSX.Element> implements ItemNodeInterface {
98
__id: string
109

1110
static getType(): string {
1211
return 'snbubble'
1312
}
1413

1514
static clone(node: BubbleNode): BubbleNode {
16-
return new BubbleNode(node.__id, node.__format, node.__key)
15+
return new BubbleNode(node.__id, node.__key)
1716
}
1817

1918
static importJSON(serializedNode: SerializedBubbleNode): BubbleNode {
2019
const node = $createBubbleNode(serializedNode.itemUuid)
21-
node.setFormat(serializedNode.format)
2220
return node
2321
}
2422

25-
exportJSON(): SerializedBubbleNode {
23+
override exportJSON(): SerializedBubbleNode {
2624
return {
27-
...super.exportJSON(),
2825
itemUuid: this.getId(),
2926
version: 1,
3027
type: 'snbubble',
@@ -57,8 +54,12 @@ export class BubbleNode extends DecoratorBlockNode implements ItemNodeInterface
5754
return { element }
5855
}
5956

60-
constructor(id: string, format?: ElementFormatType, key?: NodeKey) {
61-
super(format, key)
57+
updateDOM(): false {
58+
return false
59+
}
60+
61+
constructor(id: string, key?: NodeKey) {
62+
super(key)
6263
this.__id = id
6364
}
6465

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { Spread } from 'lexical'
2-
import { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'
1+
import { Spread, SerializedLexicalNode } from 'lexical'
32

43
export type SerializedBubbleNode = Spread<
54
{
65
itemUuid: string
76
version: 1
87
type: 'snbubble'
98
},
10-
SerializedDecoratorBlockNode
9+
SerializedLexicalNode
1110
>

packages/web/src/javascripts/Components/SuperEditor/Utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function handleEditorChange(
3030
const stringifiedEditorState = JSON.stringify(editorState.toJSON())
3131
onChange?.(stringifiedEditorState, previewText)
3232
} catch (error) {
33+
console.error(error)
3334
window.alert(
3435
`An invalid change was made inside the Super editor. Your change was not saved. Please report this error to the team: ${JSON.stringify(
3536
error,

0 commit comments

Comments
 (0)