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

Cursor can not be moved upwards out of svelte editable component #18

Closed
zwz opened this issue Mar 20, 2023 · 4 comments
Closed

Cursor can not be moved upwards out of svelte editable component #18

zwz opened this issue Mar 20, 2023 · 4 comments

Comments

@zwz
Copy link

zwz commented Mar 20, 2023

I tried the demo on https://sibiraj-s.github.io/svelte-tiptap/

  1. locate the cursor on the first paragraph.
  2. move the cursor downwards with arrow down key until the last paragraph (everything works well)
  3. move the cursor upwards with arrow up key, you'll set it is stuck in the editable component.

If you try the the demo on tiptap.dev , no such issue.

@sibiraj-s
Copy link
Owner

Thanks. Will check this. Sorry for the delay.

@aivo0
Copy link

aivo0 commented May 24, 2023

@zwz this is not a library problem but library documentation issue - the example is broken. Note that it is even worse on Firefox where one cannot even move with the down arrow. If you look at https://tiptap.dev/guide/node-views/react the span in the Component.jsx has contentEditable={false} . The reason is explained by ProseMirror's author here: https://discuss.prosemirror.net/t/nodeviews-with-contentdom-stops-the-cursor-movement-for-a-node-with-text-content/3208/6 "Generally, if you’re going to add non-content DOM structure in a node view, you have to make sure you set it uneditable, or the browser will move the cursor into it (and then ProseMirror will move it out again because it doesn’t consider that position a valid selection endpoint)."
I added contentEditable={false} to the span in https://github.com/sibiraj-s/svelte-tiptap/blob/master/src/routes/_components/Editable.svelte and it fixed the issue.

@sibiraj-s
Copy link
Owner

Thanks @aivo0 . I did not notice your comment. Yes indeed that is the solution. Make sure to add contenteditable=false to the elements that are not intended to be edited.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants