Skip to content

fix(muya): consume autoCheck + hideLinkPopup options (PG3/PG12) - #4409

Merged
Jocs merged 2 commits into
developfrom
fix/muya-consume-autocheck-hidelinkpopup
Jun 8, 2026
Merged

Jocs merged 2 commits into
developfrom
fix/muya-consume-autocheck-hidelinkpopup

Conversation

@Jocs

@Jocs Jocs commented Jun 8, 2026

Copy link
Copy Markdown
Member

Follow-up to #4406 (@muyajs/core parity). Both options were plumbed into the
new engine (muya.options via setOptions) but never consumed; this PR wires
them in and flips the corresponding parity-scoreboard specs (#4407) from
it.fails to it.

PG3 — autoCheck task-list cascade

Legacy muyajs read autoCheck in clickCtrl.js#listItemCheckBoxClick: toggling
a task-list checkbox cascaded the state to all descendant items and re-derived
ancestors. The new engine merged autoCheck into options but never read it.

block/gfm/taskListCheckbox/index.ts#update now, for a user toggle with
autoCheck on, sets every descendant task item to the same checked state and
re-derives each ancestor (checked iff all its siblings are checked). Cascaded
items mutate state via the TaskListItem.checked setter so each still dispatches
its OT replace op; their checkboxes sync via a new syncDom helper. Tree
narrowing uses block-name type guards (no double-cast).

PG12 — hideLinkPopup link-hover gate

Legacy muyajs gated the muya-link-tools dispatch on !hideLinkPopup. The new
linkMouseEvents.ts#overHandler emitted unconditionally.

overHandler now reads muya.options.hideLinkPopup live and returns early when
set, so a runtime setOptions({ hideLinkPopup }) toggle takes effect
immediately.

Tests / gates

  • parityAutoCheck.spec.ts (×2) and parityHideLinkPopup.spec.ts (×1) flipped
    to 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

Jocs and others added 2 commits June 9, 2026 01:26
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]>
Copilot AI review requested due to automatic review settings June 8, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-tools emit on muya.options.hideLinkPopup.
  • Implement autoCheck cascade + ancestor re-derivation for task-list checkboxes, including DOM sync for cascaded items.
  • Flip the PG3/PG12 parity tests from it.fails to passing it(...) 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',
@Jocs
Jocs merged commit ba5e2cb into develop Jun 8, 2026
8 checks passed
@Jocs
Jocs deleted the fix/muya-consume-autocheck-hidelinkpopup branch June 10, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants