[lexical-utils][lexical-playground] Feature: Add $insertNodeIntoLeaf and insert deeply DateTimeNode#8206
Merged
etrepum merged 4 commits intofacebook:mainfrom Mar 13, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Mar 11, 2026
| @@ -47,7 +51,11 @@ export default function DateTimePlugin(): JSX.Element | null { | |||
| const {dateTime} = payload; | |||
| const dateTimeNode = $createDateTimeNode(dateTime); | |||
Collaborator
There was a problem hiding this comment.
I think it would be simpler and probably more accurate to pick up the selection's format rather than only a bordering TextNode on insert. It's possible to insert a DateTimeNode into an empty ParagraphNode after changing the desired format but before entering any other text.
etrepum
reviewed
Mar 12, 2026
packages/lexical-playground/src/plugins/DateTimePlugin/index.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Bob Ippolito <bob@redivi.com>
etrepum
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added
$insertNodeIntoLeaffunction to insert a node into the outermost leaf node. An example of how to use this function can be seen when inserting DateTimeNode into lexical-playgroundTest plan
Before
Inserting DateTime into a link split it into two nodes, and DateTime does not become part of the link. Also, inserting DateTime does not take into account the text format. To select DateTime in a link and apply a format to it, you have to select it again
Screen.Recording.2026-03-11.at.02.05.42.mov
After
DateTime is inserted into the link and becomes part of it. If you enter formatted text, the subsequent insertion of DateTime will preserve the preceding format
Screen.Recording.2026-03-11.at.02.03.23.mov