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

[lexical-yjs] Feature: Expose function to get anchor and focus nodes for given user awareness state #6942

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

amanharwara
Copy link
Contributor

This PR exposes a getAnchorAndFocusCollabNodesForUserState function extracted from the internal sync cursor functions that allows getting the anchor/focus nodes and offsets when provided a binding and a user state.

We want to implement a "scroll to user cursor" feature, but currently there is no way to get the anchor and focus nodes for a given user as a consumer of Lexical (except for the local, of course).

This also allows for potential custom implementations of collab cursors since the implementation provided in @lexical/yjs is not very customizable.

Screen recording confirming collab cursors work even after the change:

lexical-collab-cursors.mp4

Copy link

vercel bot commented Dec 11, 2024

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

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 24, 2024 3:53pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 24, 2024 3:53pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 11, 2024
Copy link

github-actions bot commented Dec 11, 2024

size-limit report 📦

Path Size
lexical - cjs 31.21 KB (0%)
lexical - esm 31.1 KB (0%)
@lexical/rich-text - cjs 40.31 KB (0%)
@lexical/rich-text - esm 33.01 KB (0%)
@lexical/plain-text - cjs 38.85 KB (0%)
@lexical/plain-text - esm 30.22 KB (0%)
@lexical/react - cjs 42.13 KB (0%)
@lexical/react - esm 34.26 KB (0%)

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Dec 11, 2024
@amanharwara
Copy link
Contributor Author

I can't reproduce the tests failing for both the commits locally. The tests failing locally when running npm run test-e2e-collab-prod-chromium are different from these, and unrelated to the change made here from what I can tell.

Anything else I need to do here?

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. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants