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

Relax hasFocus Assumption in Cursor Plugin #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zampino
Copy link

@zampino zampino commented Mar 7, 2023

The motivation behind this is allowing cursors to be synced from within prosemirror nodes with editable custom views which propagate changes to the parent prosemirror editor. See the classical example https://prosemirror.net/examples/codemirror.

When such a node-view gains focus, prosemirror root view is blurred. Therefore, in the current implementation, the local field for sharing cursor position is deleted and not synced any more.

If we'd make, in addition, getSelection a function of the editor view instead of its state, we could allow users to reflect on the view's focus for opting out of syncing cursors by providing their own function.

I couldn't find anything specific in git history which motivates the focus assumption as opposed to checking for a selection object alone. Any pointers on how to work around this limitation in a different way is very welcome and of course many thanks to @dmonad for their work on this library!

this allows cursors to be synced from within
content-editable sub-documents which propagate changes
to the parent prosemirror editor. See for instance
https://prosemirror.net/examples/codemirror/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant