Repository navigation
fix(muya): consume autoCheck + hideLinkPopup options (PG3/PG12) - #4409
Merged
Merged
Conversation
The autoCheck option was merged into muya.options (muya.ts setOptions) but no engine code consumed it, so the legacy muyajs task-list cascade was lost (parity gap PG3 of #4406). Restore it in the task-list checkbox handler: a user toggle now sets every descendant task item to the same checked state and re-derives each ancestor (checked iff all its siblings are checked), gated on muya.options.autoCheck. Cascaded items mutate state through the TaskListItem.checked setter so each change still dispatches its OT replace op; their checkboxes sync via syncDom. Flips the parityAutoCheck scoreboard specs from it.fails to it. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The hideLinkPopup option was merged into muya.options but the link-hover emitter (linkMouseEvents.ts#overHandler) emitted muya-link-tools unconditionally, so the popover always appeared on hover even when the user set hideLinkPopup: true (parity gap PG12 of #4406). Read muya.options.hideLinkPopup live in overHandler and return early when set, mirroring legacy muyajs eventHandler/mouseEvent.js. Optional chaining keeps the existing options-less test mock working. Flips the parityHideLinkPopup scoreboard spec from it.fails to it; the positive control stays green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores legacy MarkText parity for two @muyajs/core options that were already plumbed into muya.options but not actually applied at runtime: autoCheck (task-list checkbox cascade) and hideLinkPopup (suppress link-hover popover).
Changes:
- Gate the link-hover
muya-link-toolsemit onmuya.options.hideLinkPopup. - Implement
autoCheckcascade + ancestor re-derivation for task-list checkboxes, including DOM sync for cascaded items. - Flip the PG3/PG12 parity tests from
it.failsto passingit(...)assertions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/muya/src/editor/linkMouseEvents.ts | Suppresses link-hover popover dispatch when hideLinkPopup is enabled. |
| packages/muya/src/editor/tests/parityHideLinkPopup.spec.ts | Converts PG12 parity test to passing and updates explanatory comments (one inline comment still needs adjustment). |
| packages/muya/src/block/gfm/taskListCheckbox/index.ts | Adds autoCheck cascade logic and DOM sync helper for task-list checkboxes. |
| packages/muya/src/block/gfm/taskListCheckbox/tests/parityAutoCheck.spec.ts | Converts PG3 parity tests to passing assertions for cascade + ancestor re-derivation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+104
to
+105
| setItemChecked(ancestor, computed); | ||
| list = ancestor.parent; |
Comment on lines
+83
to
84
| it( | ||
| 'PG12: with hideLinkPopup=true, hovering a preview link does NOT open the popover', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #4406 (@muyajs/core parity). Both options were plumbed into the
new engine (
muya.optionsviasetOptions) but never consumed; this PR wiresthem in and flips the corresponding parity-scoreboard specs (#4407) from
it.failstoit.PG3 —
autoChecktask-list cascadeLegacy muyajs read
autoCheckinclickCtrl.js#listItemCheckBoxClick: togglinga task-list checkbox cascaded the state to all descendant items and re-derived
ancestors. The new engine merged
autoCheckinto options but never read it.block/gfm/taskListCheckbox/index.ts#updatenow, for ausertoggle withautoCheckon, sets every descendant task item to the same checked state andre-derives each ancestor (checked iff all its siblings are checked). Cascaded
items mutate state via the
TaskListItem.checkedsetter so each still dispatchesits OT replace op; their checkboxes sync via a new
syncDomhelper. Treenarrowing uses block-name type guards (no double-cast).
PG12 —
hideLinkPopuplink-hover gateLegacy muyajs gated the
muya-link-toolsdispatch on!hideLinkPopup. The newlinkMouseEvents.ts#overHandleremitted unconditionally.overHandlernow readsmuya.options.hideLinkPopuplive and returns early whenset, so a runtime
setOptions({ hideLinkPopup })toggle takes effectimmediately.
Tests / gates
parityAutoCheck.spec.ts(×2) andparityHideLinkPopup.spec.ts(×1) flippedto passing; the hideLinkPopup positive control stays green.
pnpm -C packages/muya lint(0 errors),lint:types,check-circular,test(515 passed),test:spec(1347 passed) all green.🤖 Generated with Claude Code