From d98a7800861a9d9f48e11754aa842195ef124c37 Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Tue, 26 Nov 2024 15:49:00 -0600 Subject: [PATCH] feat(lecixal): export additional helper functions and commands --- .changeset/slimy-moons-design.md | 6 ++ .../paste-libraries/lexical/src/index.tsx | 83 +++++++++++++++++-- 2 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 .changeset/slimy-moons-design.md diff --git a/.changeset/slimy-moons-design.md b/.changeset/slimy-moons-design.md new file mode 100644 index 0000000000..cc13bd5556 --- /dev/null +++ b/.changeset/slimy-moons-design.md @@ -0,0 +1,6 @@ +--- +"@twilio-paste/core": minor +"@twilio-paste/lexical-library": minor +--- + +[Lexical Library] exported additional helper functions and commands to allow advanced editor node manipulation programatically diff --git a/packages/paste-libraries/lexical/src/index.tsx b/packages/paste-libraries/lexical/src/index.tsx index a2634e7f4b..2bffb58c2e 100644 --- a/packages/paste-libraries/lexical/src/index.tsx +++ b/packages/paste-libraries/lexical/src/index.tsx @@ -4,10 +4,7 @@ import ErrorBoundary from "@lexical/react/LexicalErrorBoundary"; import type { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin"; export { - $getRoot, - $getSelection, - $createParagraphNode, - $createTextNode, + createCommand, CLEAR_EDITOR_COMMAND, KEY_ENTER_COMMAND, COMMAND_PRIORITY_CRITICAL, @@ -15,8 +12,84 @@ export { COMMAND_PRIORITY_NORMAL, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_EDITOR, + BLUR_COMMAND, + CAN_REDO_COMMAND, + CAN_UNDO_COMMAND, + CLEAR_HISTORY_COMMAND, + CLICK_COMMAND, + CONTROLLED_TEXT_INSERTION_COMMAND, + COPY_COMMAND, + CUT_COMMAND, + DELETE_CHARACTER_COMMAND, + DELETE_LINE_COMMAND, + DELETE_WORD_COMMAND, + DRAGEND_COMMAND, + DRAGOVER_COMMAND, + DRAGSTART_COMMAND, + DROP_COMMAND, + FOCUS_COMMAND, + FORMAT_ELEMENT_COMMAND, + FORMAT_TEXT_COMMAND, + INDENT_CONTENT_COMMAND, + INSERT_LINE_BREAK_COMMAND, + INSERT_PARAGRAPH_COMMAND, + INSERT_TAB_COMMAND, + KEY_ARROW_DOWN_COMMAND, + KEY_ARROW_LEFT_COMMAND, + KEY_ARROW_RIGHT_COMMAND, + KEY_ARROW_UP_COMMAND, + KEY_BACKSPACE_COMMAND, + KEY_DELETE_COMMAND, + KEY_DOWN_COMMAND, + KEY_ESCAPE_COMMAND, + KEY_MODIFIER_COMMAND, + KEY_SPACE_COMMAND, + KEY_TAB_COMMAND, + MOVE_TO_END, + MOVE_TO_START, + OUTDENT_CONTENT_COMMAND, + PASTE_COMMAND, + REDO_COMMAND, + REMOVE_TEXT_COMMAND, + SELECT_ALL_COMMAND, + SELECTION_CHANGE_COMMAND, + UNDO_COMMAND, + $addUpdateTag, + $applyNodeReplacement, + $copyNode, + $getAdjacentNode, + $getNearestNodeFromDOMNode, + $getNearestRootOrShadowRoot, + $getNodeByKey, + $hasAncestor, + $hasUpdateTag, + $isInlineElementOrDecoratorNode, + $isLeafNode, + $isRootOrShadowRoot, + $nodesOfType, + $selectAll, + $setCompositionKey, + $setSelection, + $splitNode, + $parseSerializedNode, + $createRangeSelection, + $getPreviousSelection, + $getTextContent, + $insertNodes, + $isBlockElementNode, + $isNodeSelection, + $isRangeSelection, + $isParagraphNode, + $createLineBreakNode, + $isLineBreakNode, + $isElementNode, + $isDecoratorNode, + $getRoot, + $getSelection, + $createParagraphNode, + $createTextNode, } from "lexical"; -export type { EditorState, EditorThemeClasses, LexicalEditor } from "lexical"; +export type { EditorState, EditorThemeClasses, LexicalEditor, SerializedEditorState } from "lexical"; export { AutoLinkNode } from "@lexical/link"; export { LexicalComposer } from "@lexical/react/LexicalComposer";