Skip to content

Commit

Permalink
selectionChange fix (#3623)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored Dec 23, 2022
1 parent 5d4672c commit 90b780a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/lexical/src/LexicalUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type {LexicalNode, SerializedLexicalNode} from './LexicalNode';

import invariant from 'shared/invariant';

import {$isElementNode, $isTextNode} from '.';
import {$isElementNode, $isTextNode, SELECTION_CHANGE_COMMAND} from '.';
import {FULL_RECONCILE, NO_DIRTY_NODES} from './LexicalConstants';
import {resetEditor} from './LexicalEditor';
import {
Expand Down Expand Up @@ -596,7 +596,13 @@ export function commitPendingUpdates(editor: LexicalEditor): void {
dirtyLeaves,
);
}

if (
!$isRangeSelection(pendingSelection) &&
pendingSelection !== null &&
(currentSelection === null || !currentSelection.is(pendingSelection))
) {
editor.dispatchCommand(SELECTION_CHANGE_COMMAND, undefined);
}
/**
* Capture pendingDecorators after garbage collecting detached decorators
*/
Expand Down

2 comments on commit 90b780a

@vercel
Copy link

@vercel vercel bot commented on 90b780a Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

lexical-fbopensource.vercel.app
lexicaljs.com
www.lexical.dev
lexical-git-main-fbopensource.vercel.app
lexical.dev
lexicaljs.org

@vercel
Copy link

@vercel vercel bot commented on 90b780a Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

lexical-playground.vercel.app
lexical-playground-fbopensource.vercel.app
lexical-playground-git-main-fbopensource.vercel.app
playground.lexical.dev

Please sign in to comment.