-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(task-item): fix read only checked handling #5952
base: develop
Are you sure you want to change the base?
fix(task-item): fix read only checked handling #5952
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good code-wise. Would love to have a test for this added though to make sure that we don't regress
Great! I'm interested in adding a test, although it'll expand my task quite a bit, to set up a tiptap dev env, plus get my head around your testing environment, so let's see how that goes! Also happy if somebody else wants to jump in with that... but yeah, I'll add it to my todo list 👍 |
Fixes #3676
Changes Overview
onReadOnlyChecked
allows you to determine whether the checking/unchecking the task item should apply the change, or not.It did not work because:
Implementation Approach
Now it runs the logic inside the transaction where we have access to the current node, and we can either abort it as before if it returns
false
, or allow it to proceed with the transaction if it returnstrue
.Testing Done
Only manual testing whilst clicking in a browser.
Verification Steps
Configure your editor like this:
Then, ideally, open a couple of windows with a collaborative session running, and notice that you can check/uncheck the box in one window, but the change is not propagated to the other.
Additionally, if you want to have more logic (e.g. the kind of logic in #4521 - where the node descendent are checked for matching), it should be possible to observe the node is now the correct node, and can be matched if desired:
Additional Notes
There is also another bug, in the update method because it uses
checkbox.setAttribute('checked', 'checked')
andcheckbox.removeAttribute('checked')
which is not the correct way to change the state of a checkbox, should just becheckbox.checked = checked
.Should I add a fix to this PR? Maybe best in another one....
Update: I submitted a separate PR for that #5953
Checklist
Related Issues
#3676
#4521