Skip to content

Commit

Permalink
WIP getDOMSlot
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed Oct 23, 2024
1 parent 409c65e commit 14fda1c
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 95 deletions.
4 changes: 2 additions & 2 deletions packages/lexical/src/LexicalMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import type {TextNode} from '.';
import type {LexicalEditor} from './LexicalEditor';
import type {LexicalPrivateDOM} from './LexicalNode';
import type {BaseSelection} from './LexicalSelection';

import {IS_FIREFOX} from 'shared/environment';
Expand Down Expand Up @@ -53,11 +54,10 @@ function initTextEntryListener(editor: LexicalEditor): void {

function isManagedLineBreak(
dom: Node,
target: Node,
target: Node & LexicalPrivateDOM,
editor: LexicalEditor,
): boolean {
return (
// @ts-expect-error: internal field
target.__lexicalLineBreak === dom ||
// @ts-ignore We intentionally add this to the Node.
dom[`__lexicalKey_${editor._key}`] !== undefined
Expand Down
8 changes: 8 additions & 0 deletions packages/lexical/src/LexicalNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ export type SerializedLexicalNode = {
version: number;
};

/** @internal */
export interface LexicalPrivateDOM {
__lexicalTextContent?: string | undefined | null;
__lexicalLineBreak?: HTMLBRElement | undefined | null;
__lexicalDirTextContent?: string | undefined | null;
__lexicalDir?: 'ltr' | 'rtl' | null | undefined;
}

export function $removeNode(
nodeToRemove: LexicalNode,
restoreSelection: boolean,
Expand Down
Loading

0 comments on commit 14fda1c

Please sign in to comment.