Closed guanriyue closed 4 weeks ago
Latest commit: 072ef6d3f5de48993ec5541fb199d68ef99d02ab
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/guanriyue/tiptap/new/fix/can-clearNodes?filename=.changeset/wise-masks-hang.md&value=---%0A%22tiptap-demos%22%3A%20patch%0A%22%40tiptap%2Fcore%22%3A%20patch%0A---%0A%0AFix%20the%20issue%20where%20%60can()%60%20check%20returns%20%60false%60%20even%20when%20the%20command%20can%20be%20executed.%0A)
Name | Link |
---|---|
Latest commit | 072ef6d3f5de48993ec5541fb199d68ef99d02ab |
Latest deploy log | https://app.netlify.com/sites/tiptap-embed/deploys/6715be03c730880008f2aac6 |
Deploy Preview | https://deploy-preview-5741--tiptap-embed.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
@guanriyue did you mean to close this? I hadn't had the chance to review it
Yes, I confirm that I want to close this PR. I reevaluated the situation and created a new PR https://github.com/ueberdosis/tiptap/pull/5744, adding corresponding test cases to ensure that the changes are correct.
Changes Overview
Fix the issue where
can()
check returnsfalse
even when the command is actually executable.Implementation Approach
When
chainCommand
is executed, multiple commands are run sequentially. The editor state used by later commands may depend on the preceding commands. Therefore, when executingcan()
,createChain
must ensure thatshouldDispatch
istrue
to prevent skipping operations ontr
.This fix effectively reverts the code changes from the pull request https://github.com/ueberdosis/tiptap/pull/3026 and resolves the issue https://github.com/ueberdosis/tiptap/issues/3025 caused by the
clearNodes
error.At the same time, it will also fix issue https://github.com/ueberdosis/tiptap/issues/3229 and issue https://github.com/ueberdosis/tiptap/issues/4057.
————————————————————————————————————————————————————
For more details, please refer to this issue https://github.com/ueberdosis/tiptap/issues/5721.
Testing Done
In the example default editor, add the
disabled
attribute to the heading and list action buttons. Before the change, if the cursor was positioned on a heading node, the list action buttons would remain disabled, even though the commands were actually available. After the change, the list action buttons will be displayed as enabled.Verification Steps
None.
Additional Notes
Checklist
Related Issues