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

Prosemirror cell switching #39

Open
stefnotch opened this issue May 27, 2021 · 0 comments
Open

Prosemirror cell switching #39

stefnotch opened this issue May 27, 2021 · 0 comments

Comments

@stefnotch
Copy link
Contributor

stefnotch commented May 27, 2021

The cell switching currently doesn't support prosemirror #29

Prosemirror itself doesn't have a concept of line numbers, instead it's tree shaped (like the browser dom) and leaves most arrow key navigation things to the browser. Prosemirror uses contenteditable under the hood.

This makes figuring out if the user is at the top of the document rather tricky. For example, imagine the cursor being placed after the <br>a. Then, while the cursor is in the topmost element, it's not at the top of the document. There is still a <br> before it.

image

With some work, we might be able to cover all possible cases and implement arrow key navigation. One other approach would be to add a zero-height div at the top of the document. When it gets selected, the cell switching gets invoked.

One alternative approach would be to, when the user presses the up arrow key

  1. before anything happens, save the cursor position
  2. after the event is over, get the new cursor position and compare it to the old one
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

No branches or pull requests

1 participant