Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$insertNodes: Selection-agnostic node insertion with Grid/Node selection support #2638

Merged
merged 17 commits into from
Sep 14, 2022

Conversation

zurfyx
Copy link
Member

@zurfyx zurfyx commented Jul 13, 2022

Node selection

Screen.Recording.2022-07-13.at.3.37.18.pm.mov

Grid selection

Screen.Recording.2022-07-13.at.3.38.46.pm.mov

@vercel
Copy link

vercel bot commented Jul 13, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Sep 14, 2022 at 11:04PM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Sep 14, 2022 at 11:04PM (UTC)

useEffect(() => {
hasModifier.current = false;
const handler = (e: KeyboardEvent) => {
// debugger;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops

@@ -84,3 +84,65 @@ export function $normalizeTextNode(textNode: TextNode): void {
}
}
}

export function $normalizeSelection(selection: RangeSelection): RangeSelection {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a whole separate module in core for this? What else will go in here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, what do you mean by a new module? It has $canSimpleTextNodesBeMerged, $mergeTextNodes and $normalizeTextNode. It just felt like a good fit for another normalization function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh lol I never knew we had a LexicalNormalization module so I assumed you created it. #til

@acywatson
Copy link
Contributor

This looks awesome! Planning to step through this logic a bit more later, maybe a comment or two on the normalization logic would be good?

@acywatson
Copy link
Contributor

@zurfyx ?

Also stop using that podcast tweet as test data lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants