Skip to content

Commit

Permalink
Few missing exports that are useful (facebook#6318)
Browse files Browse the repository at this point in the history
  • Loading branch information
Piechota authored Jun 18, 2024
1 parent fcf1ae6 commit 7f9ba12
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/lexical-table/flow/LexicalTable.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ declare export function getTableObserverFromTableElement(

declare export function getDOMCellFromTarget(node: Node): null | TableDOMCell;

declare export function $findTableNode(node: LexicalNode): null | TableNode;

declare export function $findCellNode(node: LexicalNode): null | TableCellNode;

/**
* LexicalTableUtils
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/lexical-table/src/LexicalTableSelectionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ function $removeHighlightFromDOM(
element.style.removeProperty('caret-color');
}

function $findCellNode(node: LexicalNode): null | TableCellNode {
export function $findCellNode(node: LexicalNode): null | TableCellNode {
const cellNode = $findMatchingParent(node, $isTableCellNode);
return $isTableCellNode(cellNode) ? cellNode : null;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/lexical-table/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export {
} from './LexicalTableSelection';
export type {HTMLTableElementWithWithTableSelectionState} from './LexicalTableSelectionHelpers';
export {
$findCellNode,
$findTableNode,
applyTableHandlers,
getDOMCellFromTarget,
getTableObserverFromTableElement,
Expand Down
17 changes: 17 additions & 0 deletions packages/lexical/flow/Lexical.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ declare export var BLUR_COMMAND: LexicalCommand<FocusEvent>;

declare export function createCommand<T>(type?: string): LexicalCommand<T>;

/**
* LexicalConstnats
*/

declare export var IS_ALL_FORMATTING: number;
declare export var IS_BOLD: number;
declare export var IS_CODE: number;
declare export var IS_HIGHLIGHT: number;
declare export var IS_ITALIC: number;
declare export var IS_STRIKETHROUGH: number;
declare export var IS_SUBSCRIPT: number;
declare export var IS_SUPERSCRIPT: number;
declare export var IS_UNDERLIN: number;
declare export var TEXT_TYPE_TO_FORMAT: Record<TextFormatType | string, number>;

/**
* LexicalEditor
*/
Expand Down Expand Up @@ -807,6 +822,7 @@ declare export function $getNearestNodeFromDOMNode(
startingDOM: Node,
): LexicalNode | null;
declare export function $getNodeByKey<N: LexicalNode>(key: NodeKey): N | null;
declare export function $getNodeByKeyOrThrow<N: LexicalNode>(key: NodeKey): N;
declare export function $getRoot(): RootNode;
declare export function $isLeafNode<T = mixed>(
node: ?LexicalNode,
Expand All @@ -820,6 +836,7 @@ declare export function $getAdjacentNode(
focus: Point,
isBackward: boolean,
): null | LexicalNode;
declare export function resetRandomKey(): void;
declare export function generateRandomKey(): string;
declare export function $isInlineElementOrDecoratorNode<T = mixed>(
node: LexicalNode,
Expand Down
14 changes: 14 additions & 0 deletions packages/lexical/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ export {
SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,
UNDO_COMMAND,
} from './LexicalCommands';
export {
IS_ALL_FORMATTING,
IS_BOLD,
IS_CODE,
IS_HIGHLIGHT,
IS_ITALIC,
IS_STRIKETHROUGH,
IS_SUBSCRIPT,
IS_SUPERSCRIPT,
IS_UNDERLINE,
TEXT_TYPE_TO_FORMAT,
} from './LexicalConstants';
export {
COMMAND_PRIORITY_CRITICAL,
COMMAND_PRIORITY_EDITOR,
Expand Down Expand Up @@ -145,6 +157,7 @@ export {
$getNearestNodeFromDOMNode,
$getNearestRootOrShadowRoot,
$getNodeByKey,
$getNodeByKeyOrThrow,
$getRoot,
$hasAncestor,
$hasUpdateTag,
Expand All @@ -163,6 +176,7 @@ export {
isInlineDomNode,
isSelectionCapturedInDecoratorInput,
isSelectionWithinEditor,
resetRandomKey,
} from './LexicalUtils';
export {ArtificialNode__DO_NOT_USE} from './nodes/ArtificialNode';
export {$isDecoratorNode, DecoratorNode} from './nodes/LexicalDecoratorNode';
Expand Down

0 comments on commit 7f9ba12

Please sign in to comment.