增强 Mermaid 全屏缩放预览并发布 1.2.6 - #18
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a98035fc10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const handleKeyDown = (event: KeyboardEvent) => { | ||
| if (event.key !== "Escape") return; |
There was a problem hiding this comment.
Prevent global shortcuts from opening behind the viewer
While the fullscreen viewer is open in the main or note window, shortcuts such as Cmd/Ctrl+K and the quick-switcher shortcut still reach App.tsx's useGlobalShortcuts, because this capture handler only handles Escape. Those dialogs render at z-50, below this viewer's zIndex: 20000, but their inputs still take focus, so subsequent typing goes into an invisible dialog; pressing Escape then closes the viewer and reveals the unexpectedly opened dialog. Suspend the global shortcuts while this modal is active or integrate the viewer with the existing modal state.
Useful? React with 👍 / 👎.
| <div | ||
| className="absolute right-4 top-4 z-10 flex items-center gap-1 rounded-lg p-1" |
There was a problem hiding this comment.
Keep viewer controls clear of native caption buttons
On Windows and Linux, the app uses titleBarOverlay and explicitly reserves the top-right 140px for native minimize/maximize/close controls in EditorChromeBar and detached-note UnifiedBar. Positioning this toolbar at right-4 top-4 puts its close button and part of its zoom controls inside that native caption region, so clicks near the top of the viewer can minimize or close the application instead of operating the Mermaid viewer. Offset the toolbar below the 34px titlebar strip or reserve the native-control inset.
Useful? React with 👍 / 👎.
| viewport.scrollLeft = clampScrollOffset( | ||
| (viewport.scrollLeft + pending.pointerOffsetX) * ratio - | ||
| pending.pointerOffsetX, |
There was a problem hiding this comment.
Exclude fixed viewport padding from anchor scaling
The viewport has fixed 32px horizontal and 64px top padding, but this formula scales scrollLeft + pointerOffsetX as though the diagram began at the viewport's scroll origin. Consequently, trackpad or toolbar zoom does not keep the selected point stationary: zooming from 100% to 800% accumulates about 224px of horizontal and 448px of vertical anchor error from the padding alone. Subtract the unscaled padding before applying the ratio and add it back afterward; the corresponding scrollTop calculation has the same issue.
Useful? React with 👍 / 👎.
功能
验证
npm test:2402 passed,7 skippednpm run lintnpm run renderer:buildnode scripts/sync-tauri-version.mjs --check 1.2.6cargo metadata --format-version 1 --no-deps --locked