Skip to content

Commit

Permalink
Select end if root has no children (#3254)
Browse files Browse the repository at this point in the history
  • Loading branch information
thegreatercurve authored Oct 25, 2022
1 parent 4f80cd2 commit 64cc4d3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/lexical/src/LexicalEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,10 @@ export class LexicalEditor {
if (selection !== null) {
// Marking the selection dirty will force the selection back to it
selection.dirty = true;
} else if (root.getChildrenSize() !== 0) {
if (options.defaultSelection === 'rootStart') {
root.selectStart();
} else {
root.selectEnd();
}
} else if (options.defaultSelection === 'rootStart') {
root.selectStart();
} else {
root.selectEnd();
}
},
{
Expand Down

2 comments on commit 64cc4d3

@vercel
Copy link

@vercel vercel bot commented on 64cc4d3 Oct 25, 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

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

@vercel
Copy link

@vercel vercel bot commented on 64cc4d3 Oct 25, 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-fbopensource.vercel.app
playground.lexical.dev
lexical-playground.vercel.app
lexical-playground-git-main-fbopensource.vercel.app

Please sign in to comment.