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/Missing feature]: OnReadOnlyChecked #4521

Open
1 of 2 tasks
SeDemal opened this issue Oct 10, 2023 · 3 comments
Open
1 of 2 tasks

[Bug/Missing feature]: OnReadOnlyChecked #4521

SeDemal opened this issue Oct 10, 2023 · 3 comments
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

@SeDemal
Copy link

SeDemal commented Oct 10, 2023

Which packages did you experience the bug in?

Extension-task-item

What Tiptap version are you using?

2.1.11

What’s the bug you are facing?

The function OnReadOnlyCheck doesn't update the editor, only the checkbox visibly.
task-item.ts line 135
It has the node and value of the tick in it's parameters to try and offer the possibility to manually update the editor but running the following function:

onReadOnlyChecked: (node, checked) => {
  editor!.state.doc.descendants((subnode, pos) => {
    if (node.eq(subnode)) {
      const { tr } = editor!.state;
      tr.setNodeMarkup(pos, undefined, {
        ...node.attrs,
        checked: checked,
      });
      editor!.view.dispatch(tr);
    }
  });
  return true;
},

The nodes never match using node.eq(subnode). <= This is what I think is a bug unless I am doing something wrong.

Now that test would not be needed if the position was also given in the parameters. <= Missing feature?
It would also be nice if we could get the editor as parameter, like the other basic events do.

What browser are you using?

Other

Code example

No response

What did you expect to happen?

For node.eq(subnode) to return "true" once.
I actually tried to isolate those nodes values and found that they should in fact be matching but yet aren't.w

Anything to add? (optional)

No response

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. 💖
@SeDemal SeDemal 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 Oct 10, 2023
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Oct 10, 2023
@SeDemal
Copy link
Author

SeDemal commented Oct 10, 2023

I've noticed #3676 also refers to the same problem but isn't solved nor does it offer a simple solution that isn't "patchwork".

@nicksellen
Copy link

I posted my kludgey fix here 👉 #3676 (comment) - maybe helps!

@nicksellen
Copy link

And a PR that should hopefully resolve it 👉 #5952

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
No open projects
Status: Triage open
Development

No branches or pull requests

4 participants