Repository navigation
fix(desktop): pass imageAction + getPathForFile to Muya constructor (re-activate PG4/5/6) - #4417
Merged
Merged
Conversation
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]>
Contributor
There was a problem hiding this comment.
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: muyaImageActionto the Muya constructor options (engine-level, distinct from the ImageEditTool plugin option). - Pass
getPathForFilevia the existing preload bridgewindow.electron.webUtils.getPathForFile(file).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Build artifacts for PR #4417: Run: https://github.com/marktext/marktext/actions/runs/27173999582
|
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.
What
The
#4406editor.vue rewrite dropped the constructor-levelimageAction(and the newgetPathForFile) options from thenew Muya(ele, options)call. The engine reads these frommuya.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
ImageEditToolplugin'simageActionoption (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 constructoroptions. ThemuyaImageActionadapter and thewebUtils.getPathForFilepreload 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:
typecheckclean, no new lint errors. Gesture paths to be manual-QA'd. Part of the muyajs → @muyajs/core migration.