Skip to content

fix(desktop): pass imageAction + getPathForFile to Muya constructor (re-activate PG4/5/6) - #4417

Merged
Jocs merged 1 commit into
developfrom
fix/desktop-image-constructor-options
Jun 8, 2026
Merged

Jocs merged 1 commit into
developfrom
fix/desktop-image-constructor-options

Conversation

@Jocs

@Jocs Jocs commented Jun 8, 2026

Copy link
Copy Markdown
Member

What

The #4406 editor.vue rewrite dropped the constructor-level imageAction (and the new getPathForFile) options from the new Muya(ele, options) call. The engine reads these from muya.options.*:

  • packages/muya/src/clipboard/index.ts:825 — const { imageAction } = this.muya.options (PG5 binary paste, PG6 file paste)
  • packages/muya/src/editor/dragDropImage.ts:168/215/221 — muya.options.imageAction + muya.options.getPathForFile (PG4)

These are distinct from the ImageEditTool plugin's imageAction option (which was kept). Without the constructor options, three already-merged engine fixes were silently inert on the desktop:

Fix

Add imageAction: muyaImageAction + getPathForFile: (file) => window.electron.webUtils.getPathForFile(file) to the constructor options. The muyaImageAction adapter and the webUtils.getPathForFile preload bridge already exist.

Why it slipped

The PG4/PG5/PG6 e2e are manual-QA (headless can't drive real drag/clipboard-bitmap gestures), so the missing wiring wasn't caught by the automated scoreboard — a concrete data point for the Phase G real-app verification.

Verified: typecheck clean, no new lint errors. Gesture paths to be manual-QA'd. Part of the muyajs → @muyajs/core migration.

The #4406 editor.vue rewrite dropped the constructor-level `imageAction`
(and the new `getPathForFile`) options. The engine's clipboard and drag-drop
handlers read these from `muya.options.*` (clipboard/index.ts:825,
editor/dragDropImage.ts:168/215/221) — distinct from the ImageEditTool plugin
option. Without them, three already-merged engine image fixes were silently
inert on the desktop:
  - PG4: local-file drag-drop image insertion
  - PG5: screenshot / binary clipboard paste persistence
  - PG6: copy-to-assets / upload preference on a pasted image file (raw path inserted)

Wire both into the constructor options (web-link drag-drop already worked).
The actual gesture paths remain manual-QA — headless e2e cannot drive them,
which is exactly why this slipped past the scoreboard.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings June 8, 2026 23:40

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

Restores desktop wiring for @muyajs/core image persistence by passing the engine-level imageAction and getPathForFile hooks into the Muya constructor options, re-enabling the already-merged engine implementations for drag/drop and clipboard image handling (PG4/PG5/PG6).

Changes:

  • Pass imageAction: muyaImageAction to the Muya constructor options (engine-level, distinct from the ImageEditTool plugin option).
  • Pass getPathForFile via the existing preload bridge window.electron.webUtils.getPathForFile(file).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

Build artifacts for PR #4417:

Run: https://github.com/marktext/marktext/actions/runs/27173999582

Artifact Size Link
marktext-windows-arm64 256.2 MB Download
marktext-linux 556.4 MB Download
marktext-windows-x64 257.5 MB Download
marktext-macos-x64 256.8 MB Download
marktext-macos-arm64 246.6 MB Download

@Jocs
Jocs merged commit 4f6c3f9 into develop Jun 8, 2026
11 checks passed
@Jocs
Jocs deleted the fix/desktop-image-constructor-options branch June 10, 2026 07:08
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