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

[Bug]: Unexpected cursor behavior #5903

Closed
1 task done
icyxianyu opened this issue Dec 2, 2024 · 1 comment
Closed
1 task done

[Bug]: Unexpected cursor behavior #5903

icyxianyu opened this issue Dec 2, 2024 · 1 comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@icyxianyu
Copy link

icyxianyu commented Dec 2, 2024

Affected Packages

core

Version(s)

2.0.8

Bug Description

I tried to implement a custom extension to achieve behavior similar to an inline input box with a placeholder.
image

However, when I tried to switch left and right through the keyboard, I couldn't get the cursor to enter the custom extension,custom components will be selected for all ;

At the same time, I also found that rows with custom extensions had abnormal behavior to switch up and down.

录屏2024-12-01 15 02 23

here is a demo: https://codesandbox.io/p/sandbox/hrjg4g

How can I fix it ? Or is there another implementation?

i also open a discussions: #5898

Browser Used

Chrome

Code Example URL

https://codesandbox.io/p/sandbox/hrjg4g

Expected Behavior

can enter the custom component normally through the keyboard, and the row where the custom component is located can be switched to other rows normally by pressing the up and down buttons.

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.
@icyxianyu icyxianyu added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Dec 2, 2024
@bdbch
Copy link
Member

bdbch commented Dec 2, 2024

The problem is that you don't use <NodeViewContent />.

https://tiptap.dev/docs/editor/extensions/custom-extensions/node-views/react

ProseMirror won't handle custom contentEditable fields that are not part of it's state (which your implementation is not).

You could use NodeViewContent and the actual nodes textContent as a value and don't do any custom event handling inside the node view.

@bdbch bdbch closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

2 participants