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 1 commit 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 11, 2024 2:48pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 2:48pm

@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

size-limit report 📦

Path Size
lexical - cjs 31.18 KB (0%)
lexical - esm 31 KB (0%)
@lexical/rich-text - cjs 40.15 KB (0%)
@lexical/rich-text - esm 32.83 KB (0%)
@lexical/plain-text - cjs 38.79 KB (0%)
@lexical/plain-text - esm 30.15 KB (0%)
@lexical/react - cjs 42 KB (0%)
@lexical/react - esm 34.23 KB (0%)

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Dec 11, 2024
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