diff --git a/src/plugins/core/NestedLexicalEditor.tsx b/src/plugins/core/NestedLexicalEditor.tsx index c5ac4234..df564d8b 100644 --- a/src/plugins/core/NestedLexicalEditor.tsx +++ b/src/plugins/core/NestedLexicalEditor.tsx @@ -44,6 +44,7 @@ import { mergeRegister } from '@lexical/utils' import { VoidEmitter } from '../../utils/voidEmitter' import { isPartOftheEditorUI } from '../../utils/isPartOftheEditorUI' import { useCellValues, usePublisher } from '@mdxeditor/gurx' +import { DirectiveNode } from '../directives' /** * The value of the {@link NestedEditorsContext} React context. @@ -107,9 +108,8 @@ export function useMdastNodeUpdater() { parentEditor.update( () => { $addUpdateTag('history-push') - const currentNode = $getNodeByKey(lexicalNode.getKey()) + const currentNode = $getNodeByKey(lexicalNode.getKey()) as typeof lexicalNode if (currentNode) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call currentNode.setMdastNode({ ...mdastNode, ...node }) } }, diff --git a/src/plugins/core/index.ts b/src/plugins/core/index.ts index 806f83bb..c8a8f150 100644 --- a/src/plugins/core/index.ts +++ b/src/plugins/core/index.ts @@ -754,10 +754,12 @@ export const insertDecoratorNode$ = Signal<() => DecoratorNode>((r) => } else { $insertNodeToNearestRoot(node) } - if ('select' in node && typeof node.select === 'function') { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - setTimeout(() => node.select()) - } + setTimeout(() => { + if ('select' in node && typeof node.select === 'function') { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + node.select() + } + }) }) setTimeout(() => { diff --git a/src/plugins/directives/DirectiveNode.tsx b/src/plugins/directives/DirectiveNode.tsx index b654a569..c7f93fe7 100644 --- a/src/plugins/directives/DirectiveNode.tsx +++ b/src/plugins/directives/DirectiveNode.tsx @@ -20,7 +20,6 @@ export type SerializedDirectiveNode = Spread< SerializedLexicalNode > -let GENERATION = 0 /** * A lexical node that represents an image. Use {@link "$createDirectiveNode"} to construct one. * @group Directive @@ -52,7 +51,6 @@ export class DirectiveNode extends DecoratorNode { constructor(mdastNode: Directives, key?: NodeKey) { super(key) this.__mdastNode = mdastNode - this.generation = GENERATION++ } /**