Skip to content

Commit

Permalink
[lexical] Chore: Added missing isInline function to TextNode (#7226)
Browse files Browse the repository at this point in the history
Co-authored-by: Bob Ippolito <bob@redivi.com>
  • Loading branch information
mrdivyansh and etrepum authored Feb 28, 2025
1 parent cb89344 commit 2a08be2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/lexical/flow/Lexical.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ declare export class TextNode extends LexicalNode {
getFormat(): number;
getStyle(): string;
isComposing(): boolean;
isInline(): true;
isToken(): boolean;
isSegmented(): boolean;
isDirectionless(): boolean;
Expand Down Expand Up @@ -698,6 +699,7 @@ declare export class LineBreakNode extends LexicalNode {
getTextContent(): '\n';
createDOM(): HTMLElement;
updateDOM(): false;
isInline(): true;
static importJSON(
serializedLineBreakNode: SerializedLineBreakNode,
): LineBreakNode;
Expand Down
4 changes: 4 additions & 0 deletions packages/lexical/src/nodes/LexicalLineBreakNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export class LineBreakNode extends LexicalNode {
return false;
}

isInline(): true {
return true;
}

static importDOM(): DOMConversionMap | null {
return {
br: (node: Node) => {
Expand Down
7 changes: 7 additions & 0 deletions packages/lexical/src/nodes/LexicalTextNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@ export class TextNode extends LexicalNode {
return true;
}

/**
* @returns true if the text node is inline, false otherwise.
*/
isInline(): true {
return true;
}

// View

createDOM(config: EditorConfig, editor?: LexicalEditor): HTMLElement {
Expand Down

0 comments on commit 2a08be2

Please sign in to comment.