Skip to content

Commit

Permalink
flow types
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed Nov 11, 2024
1 parent 50dadbc commit 9bc9c33
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
3 changes: 0 additions & 3 deletions packages/lexical-playground/__tests__/e2e/Tables.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3048,17 +3048,14 @@ test.describe.parallel('Tables', () => {
await insertTable(page, 2, 2);

await click(page, '.PlaygroundEditorTheme__tableCell');
await page.pause();
await selectCellsFromTableCords(
page,
{x: 0, y: 0},
{x: 1, y: 0},
true,
true,
);
await page.pause();
await insertTableColumnBefore(page);
await page.pause();

await assertHTML(
page,
Expand Down
4 changes: 2 additions & 2 deletions packages/lexical-table/src/LexicalTableObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ export class TableObserver {
* above the table will move the caret after the table and then lexical
* will select the last cell instead of the first.
* We do still want to let the browser handle caret movement but we will
* tag the update so that we can recheck the selection after the event
* is processed.
* use this property to "tag" the update so that we can recheck the
* selection after the event is processed.
*/
setShouldCheckSelection(): void {
this.shouldCheckSelection = true;
Expand Down
28 changes: 28 additions & 0 deletions packages/lexical/flow/Lexical.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ declare export class LexicalNode {
selectPrevious(anchorOffset?: number, focusOffset?: number): RangeSelection;
selectNext(anchorOffset?: number, focusOffset?: number): RangeSelection;
markDirty(): void;
reconcileObservedMutation(dom: HTMLElement, editor: LexicalEditor): void;
}
export type NodeMap = Map<NodeKey, LexicalNode>;

Expand Down Expand Up @@ -790,11 +791,38 @@ declare export class ElementNode extends LexicalNode {
nodesToInsert: Array<LexicalNode>,
): this;
exportJSON(): SerializedElementNode;
getDOMSlot(dom: HTMLElement): ElementDOMSlot;
}
declare export function $isElementNode(
node: ?LexicalNode,
): node is ElementNode;

/**
* ElementDOMSlot
*/
declare export class ElementDOMSlot {
element: HTMLElement;
before: Node | null;
after: Node | null;
constructor(element: HTMLElement, before?: Node | null | void, after?: Node | null | void): void;
withBefore(before: Node | null | void): ElementDOMSlot;
withAfter(after: Node | null | void): ElementDOMSlot;
withElement(element: HTMLElement): ElementDOMSlot;
insertChild(dom: Node): this;
removeChild(dom: Node): this;
replaceChild(dom: Node, prevDom: Node): this;
getFirstChild(): Node | null;
//
getManagedLineBreak(): HTMLElement | null;
removeManagedLineBreak(): void;
insertManagedLineBreak(webkitHack: boolean): void;
getFirstChildOffset(): number;
resolveChildIndex(element: ElementNode, elementDOM: HTMLElement, initialDOM: Node, initialOffset: number): [node: ElementNode, idx: number];
}

declare export function setDOMUnmanaged(elementDOM: HTMLElement): void;
declare export function isDOMUnmanaged(elementDOM: HTMLElement): boolean;

/**
* LexicalDecoratorNode
*/
Expand Down

0 comments on commit 9bc9c33

Please sign in to comment.