diff --git a/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/BubbleNode.tsx b/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/BubbleNode.tsx index 5be07523d..22109be00 100644 --- a/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/BubbleNode.tsx +++ b/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/BubbleNode.tsx @@ -1,11 +1,10 @@ -import { DOMConversionMap, DOMExportOutput, ElementFormatType, LexicalEditor, NodeKey } from 'lexical' -import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode' +import { DOMConversionMap, DOMExportOutput, DecoratorNode, LexicalEditor, NodeKey } from 'lexical' import { $createBubbleNode, convertToBubbleElement } from './BubbleUtils' import { BubbleComponent } from './BubbleComponent' import { SerializedBubbleNode } from './SerializedBubbleNode' import { ItemNodeInterface } from '../../ItemNodeInterface' -export class BubbleNode extends DecoratorBlockNode implements ItemNodeInterface { +export class BubbleNode extends DecoratorNode implements ItemNodeInterface { __id: string static getType(): string { @@ -13,18 +12,16 @@ export class BubbleNode extends DecoratorBlockNode implements ItemNodeInterface } static clone(node: BubbleNode): BubbleNode { - return new BubbleNode(node.__id, node.__format, node.__key) + return new BubbleNode(node.__id, node.__key) } static importJSON(serializedNode: SerializedBubbleNode): BubbleNode { const node = $createBubbleNode(serializedNode.itemUuid) - node.setFormat(serializedNode.format) return node } - exportJSON(): SerializedBubbleNode { + override exportJSON(): SerializedBubbleNode { return { - ...super.exportJSON(), itemUuid: this.getId(), version: 1, type: 'snbubble', @@ -57,8 +54,12 @@ export class BubbleNode extends DecoratorBlockNode implements ItemNodeInterface return { element } } - constructor(id: string, format?: ElementFormatType, key?: NodeKey) { - super(format, key) + updateDOM(): false { + return false + } + + constructor(id: string, key?: NodeKey) { + super(key) this.__id = id } diff --git a/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/SerializedBubbleNode.tsx b/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/SerializedBubbleNode.tsx index 262798f4f..4663ede01 100644 --- a/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/SerializedBubbleNode.tsx +++ b/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemBubblePlugin/Nodes/SerializedBubbleNode.tsx @@ -1,5 +1,4 @@ -import { Spread } from 'lexical' -import { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode' +import { Spread, SerializedLexicalNode } from 'lexical' export type SerializedBubbleNode = Spread< { @@ -7,5 +6,5 @@ export type SerializedBubbleNode = Spread< version: 1 type: 'snbubble' }, - SerializedDecoratorBlockNode + SerializedLexicalNode > diff --git a/packages/web/src/javascripts/Components/SuperEditor/Utils.ts b/packages/web/src/javascripts/Components/SuperEditor/Utils.ts index 3c8154051..ed3257c23 100644 --- a/packages/web/src/javascripts/Components/SuperEditor/Utils.ts +++ b/packages/web/src/javascripts/Components/SuperEditor/Utils.ts @@ -30,6 +30,7 @@ export function handleEditorChange( const stringifiedEditorState = JSON.stringify(editorState.toJSON()) onChange?.(stringifiedEditorState, previewText) } catch (error) { + console.error(error) window.alert( `An invalid change was made inside the Super editor. Your change was not saved. Please report this error to the team: ${JSON.stringify( error,