Skip to content

Commit

Permalink
Fix : Can't convert paragraph into a header if the first child of the…
Browse files Browse the repository at this point in the history
… paragraph is a LineBreakNode (#4776)
  • Loading branch information
naveen8801 authored Jul 17, 2023
1 parent cae9891 commit ccf8bf3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/lexical-selection/src/range-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
$isDecoratorNode,
$isElementNode,
$isLeafNode,
$isLineBreakNode,
$isRangeSelection,
$isRootNode,
$isRootOrShadowRoot,
Expand Down Expand Up @@ -92,7 +93,10 @@ function isBlock(node: LexicalNode): boolean {

const firstChild = node.getFirstChild();
const isLeafElement =
firstChild === null || $isTextNode(firstChild) || firstChild.isInline();
firstChild === null ||
$isLineBreakNode(firstChild) ||
$isTextNode(firstChild) ||
firstChild.isInline();

return !node.isInline() && node.canBeEmpty() !== false && isLeafElement;
}
Expand Down

2 comments on commit ccf8bf3

@vercel
Copy link

@vercel vercel bot commented on ccf8bf3 Jul 17, 2023

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

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

@vercel
Copy link

@vercel vercel bot commented on ccf8bf3 Jul 17, 2023

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-git-main-fbopensource.vercel.app
playground.lexical.dev
lexical-playground-fbopensource.vercel.app

Please sign in to comment.