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

Node view selected prop doesn't get updated when node is selected #3040

Open
2 tasks done
Deckluhm opened this issue Jul 28, 2022 · 9 comments
Open
2 tasks done

Node view selected prop doesn't get updated when node is selected #3040

Deckluhm opened this issue Jul 28, 2022 · 9 comments
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@Deckluhm
Copy link
Contributor

What’s the bug you are facing?

I'm trying to use the node view selected prop (https://tiptap.dev/guide/node-views/vue#selected) but it doesn't get updated when the node is selected.

Which browser was this experienced in? Are any special extensions installed?

Firefox 103.0 on Ubuntu 22.04.

No special extensions, just @tiptap/starter-kit + a custom node view to show the issue.

How can we reproduce the bug on our side?

  1. Open the CodeSandbox provided below
  2. Click anywhere on the bold text (which is the custom node)
  3. Text between parenthesis should change to "selected" but it's not the case

Can you provide a CodeSandbox?

https://codesandbox.io/s/tiptap-node-view-selected-prop-issue-yneccj

What did you expect to happen?

Node view selected prop value should be true if selection is at node position (as stated in the docs).

Anything to add? (optional)

This is the first time I'm using this prop so I don't know if it already worked and if it did, when it stopped working.

It's probably the same issue than #2819.

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@Deckluhm Deckluhm added the Type: Bug The issue or pullrequest is related to a bug label Jul 28, 2022
@lilingxi01
Copy link

lilingxi01 commented Aug 1, 2022

I have also encountered it (on React), and I believe that #2819 is the same problem with this issue based on the demo.

@lilingxi01
Copy link

There is a temporary workaround: use Focus extension (https://tiptap.dev/api/extensions/focus) and some CSS selector trick to get the focus state.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Jan 23, 2023
@Deckluhm
Copy link
Contributor Author

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days

Commenting because this is still an issue.

@github-actions github-actions bot removed the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Jan 25, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Apr 26, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2023
@bdbch bdbch reopened this Jun 6, 2023
@github-actions github-actions bot removed the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Jun 7, 2023
@segevfiner
Copy link
Contributor

segevfiner commented Aug 3, 2023

It seems to only update when the node itself is selected as a NodeSelection and not when its a part of a TextSelection, this behavior seems to come from ProseMirror's NodeView.selectNode/deselectNode, and frankly, it's not very useful unless you really need to special case a NodeSelection... I guess listening for the selection and checking it's range yourself is currently needed. That or some extension that will add decorations that can be checked for.

@bdbch bdbch added this to Tiptap Aug 4, 2023
@bdbch bdbch moved this to Triage open in Tiptap Aug 4, 2023
@bdbch
Copy link
Member

bdbch commented Aug 5, 2023

I added some functionality for updating the prop when the selection is around. Maybe this fixed the issue?

#4148

Which version were you using / Could you try the most recent 2.1.0-rc.* version?

@segevfiner
Copy link
Contributor

@bdbch This seems only for React? I'm using Vue 3.

@ghost
Copy link

ghost commented Feb 28, 2024

same issue, i m try make custom paragraph but i cant get paragraph props.selected with vue3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Status: Triage open
Development

No branches or pull requests

4 participants