Skip to content

Port upstream linked image modifier click fix#73

Open
Renakoni wants to merge 1 commit into
sync/upstream-4861-prism-dependency-orderfrom
sync/upstream-4858-linked-image-modifier-click
Open

Port upstream linked image modifier click fix#73
Renakoni wants to merge 1 commit into
sync/upstream-4861-prism-dependency-orderfrom
sync/upstream-4858-linked-image-modifier-click

Conversation

@Renakoni

@Renakoni Renakoni commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Upstream

Ports marktext/marktext#4858: marktext/marktext#4858

This is stacked on #69 (sync/upstream-4861-prism-dependency-order) because the focused Muya tests boot the editor and Android main still has the pre-#4861 Prism dynamic import issue under Vitest.

Android relevance

Android carries the same Muya link and image click handlers. Modifier-click is primarily desktop-style, but Android devices can use hardware keyboards, mice, tablets, and Chromebooks; keeping Muya's event contract aligned also prevents the image preview handler from racing the link handler for linked images.

Changes

  • Export Muya's LINK_SELECTOR so image selection can reuse the same definition of link wrappers.
  • Suppress image-preview format-click emission when a modifier-clicked image is inside a link wrapper.
  • Preserve existing plain-image modifier-click preview behavior.
  • Add regression coverage for linked images and plain images.

Verification

  • pnpm --dir third_party/muya exec vitest run src/selection/__tests__/linkedImageClick.spec.ts src/selection/__tests__/duplicateImageResize.spec.ts src/selection/__tests__/parityPreviewImage.spec.ts src/__tests__/formatClickEvents.spec.ts
  • pnpm build

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.

1 participant