Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/next' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jul 21, 2023
2 parents 8d3f4ba + c66ed37 commit a4b1441
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/lexical-editor/src/nodes/HeadingNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
HeadingTagType,
SerializedHeadingNode as BaseSerializedHeadingNode
} from "@lexical/rich-text";
import { $createParagraphNode, ParagraphNode } from "~/nodes/ParagraphNode";
import { ParagraphNode } from "~/nodes/ParagraphNode";

export type SerializeHeadingNode = Spread<
{
Expand Down Expand Up @@ -152,9 +152,7 @@ export class HeadingNode
}

override collapseAtStart(): true {
const newElement = !this.isEmpty()
? $createHeadingNode(this.getTag())
: $createParagraphNode();
const newElement = $createHeadingNode(this.getTag());
const children = this.getChildren();
children.forEach(child => newElement.append(child));
this.replace(newElement);
Expand Down

0 comments on commit a4b1441

Please sign in to comment.