Skip to content

FIx: switch path-browserify to Pathe + image pasting on windows + cleanup console.logs - #4274

Merged
Jocs merged 4 commits into
developfrom
feat/fix-win-paths
May 24, 2026
Merged

Jocs merged 4 commits into
developfrom
feat/fix-win-paths

Conversation

@Tkaixiang

Copy link
Copy Markdown
Member

Closes #

Summary

Type of change

  • [ X ] Bug fix (non-breaking, fixes an issue)
  • New feature (non-breaking, adds functionality)
  • Breaking change (causes existing functionality to change)
  • Documentation update

Test plan

  • New tests added (or explain why not needed)
  • Manually tested on:

Notes for reviewers [optional]


By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@github-actions

github-actions Bot commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Build artifacts for PR #4274:

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

Artifact Size Link
marktext-linux 594.6 MB Download
marktext-macos-x64 272.5 MB Download
marktext-windows 272.9 MB Download
marktext-macos-arm64 262.3 MB Download

@Tkaixiang Tkaixiang changed the title FIx: switch path-browserify to Pathe + remove some console.logs FIx: switch path-browserify to Pathe + image pasting on windows + cleanup console.logs May 24, 2026
@Tkaixiang
Tkaixiang requested review from Jocs and Copilot May 24, 2026 11:44

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 switches renderer/preload path handling from path-browserify to pathe, fixes Windows image paste handling by snapshotting clipboard image data before async work, and removes debug logging from editor image/file-change flows.

Changes:

  • Replaces path-browserify dependency/configuration with pathe and updates exposed window.path typings.
  • Moves clipboard image item extraction before awaiting clipboard file-path lookup.
  • Cleans up editor debug logs and applies minor formatting/settings updates.

Reviewed changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/types/shims.d.ts Removes the old path-browserify type shim.
src/types/global.d.ts Updates PathAPI to match the exposed preload surface.
src/renderer/src/prefComponents/image/components/folderSetting/index.vue Reflows the folder settings title markup.
src/renderer/src/components/editorWithTabs/editor.vue Removes debug logs and reformats several expressions.
src/preload/index.ts Replaces preload path bridge implementation with pathe.
src/muya/lib/utils/index.js Replaces direct path-browserify import with pathe.
src/muya/lib/contentState/pasteCtrl.js Snapshots clipboard image file synchronously before async path lookup.
package.json Replaces path-browserify with pathe.
electron.vite.config.ts Updates preload bundling and renderer alias/optimization for pathe.
.vscode/settings.json Changes VS Code formatting defaults to ESLint with format-on-save.

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

Comment thread src/preload/index.ts Resolved
Comment thread electron.vite.config.ts Resolved
Comment thread src/muya/lib/utils/index.js Resolved
@Jocs
Jocs merged commit d4f17e6 into develop May 24, 2026
14 checks passed
@Jocs
Jocs deleted the feat/fix-win-paths branch May 24, 2026 12:11
thimbleberrysystems pushed a commit to thimbleberrysystems/WordBird that referenced this pull request Jun 21, 2026
…anup console.logs (marktext#4274)

* FIx: switch path-browserify to Pathe + remove some console.logs

* Update pnpm lock

* Fix linting issues

* Fix image pasteCtrl
Jocs added a commit that referenced this pull request Oct 9, 2026
…5683)

The sandboxed renderer's `window.path` shim is `pathe`, which always uses
`/` (#4244, #4274), while the watcher, the main process and the Electron
shell APIs use OS-native separators (`\` on Windows). Comparing those paths
with `===` silently missed matches on Windows, which broke folder
rename/delete, new-file and tab lookups, and the Delete/F2 key guards.

This restores the Windows tree behavior that #728 fixed with the native
`path.sep`; the sandbox migration replaced node's `path` with `pathe`,
regressing it.

- Compare tree paths with `isSamePathSync` so renamed/deleted folders stop
  lingering in the sidebar.
- Use the same comparison for the new-file cache, the current-file
  highlight, tab switch/save-status and rename bookkeeping.
- Make `isPathWithinRoot` separator-insensitive so Delete/F2 reach files.
- Convert renderer `/` paths to the native separator at the shell boundary
  (`shell.trashItem` / `showItemInFolder` / `openPath`), fixing the Windows
  "Failed to parse path" error. `mt::fs::*` needs no change: fs-extra
  accepts `/` on Windows.
Jocs added a commit that referenced this pull request Oct 10, 2026
…5683) (#5689)

The sandboxed renderer's `window.path` shim is `pathe`, which always uses
`/` (#4244, #4274), while the watcher, the main process and the Electron
shell APIs use OS-native separators (`\` on Windows). Comparing those paths
with `===` silently missed matches on Windows, which broke folder
rename/delete, new-file and tab lookups, and the Delete/F2 key guards.

This restores the Windows tree behavior that #728 fixed with the native
`path.sep`; the sandbox migration replaced node's `path` with `pathe`,
regressing it.

- Compare tree paths with `isSamePathSync` so renamed/deleted folders stop
  lingering in the sidebar.
- Use the same comparison for the new-file cache, the current-file
  highlight, tab switch/save-status and rename bookkeeping.
- Make `isPathWithinRoot` separator-insensitive so Delete/F2 reach files.
- Convert renderer `/` paths to the native separator at the shell boundary
  (`shell.trashItem` / `showItemInFolder` / `openPath`), fixing the Windows
  "Failed to parse path" error. `mt::fs::*` needs no change: fs-extra
  accepts `/` on Windows.
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.

3 participants