fix(diagram): mermaid zoom buttons dead after cached tab restore; Ctrl+= zooms in#3
Open
matthew-zb wants to merge 1 commit into
Open
fix(diagram): mermaid zoom buttons dead after cached tab restore; Ctrl+= zooms in#3matthew-zb wants to merge 1 commit into
matthew-zb wants to merge 1 commit into
Conversation
…s in Two fixes for 'diagram zoom sometimes does nothing': - Tab switch restores preview via innerHTML from the render cache, which recreates the mermaid zoom buttons without their click listeners. Move click handling to a single delegated listener on #preview so buttons work regardless of how the DOM was (re)created. - Ctrl+= (plus key without Shift) was mapped to zoom reset, so keyboard zoom-in silently never zoomed. Follow browser convention: Ctrl+= / Ctrl++ zoom in, Ctrl+0 resets. Toolbar tooltips already documented this mapping. Update About dialog shortcut table and add a reset tooltip to the zoom level indicator. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
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.
Summary
Fixes the intermittent "diagram zoom does nothing" report. Two root causes:
1. Zoom buttons lose their click listeners after a cached tab restore
Switching back to a previously rendered tab restores the preview via
preview.innerHTML = tab.renderedHTML(src/tabs.js). This recreates the mermaid zoom buttons from serialized HTML — markup survives, event listeners don't — leaving visually intact but dead buttons. Fresh opens and F5 re-render from scratch, which is why the bug only reproduced "sometimes."Fix: replace per-button listeners with a single delegated click listener on
#preview, so buttons work no matter how the DOM was (re)created.2.
Ctrl+=was mapped to zoom reset instead of zoom inOn most keyboards "Ctrl and the + key" without Shift produces
key === '=', which was mapped to reset — so keyboard zoom-in silently never zoomed. Now follows browser convention:Ctrl++/Ctrl+=zoom in,Ctrl+0resets. The toolbar tooltips already documented this mapping ("Zoom In (Ctrl+=)", "리셋 (Ctrl+0)"); this aligns the code with them.Also updates the About dialog shortcut table (
Ctrl + + / =→ Zoom In,Ctrl + 0→ Reset Zoom) and adds aReset Zoom (Ctrl+0)tooltip to the zoom level indicator.Test plan
Ctrl+=zooms in,Ctrl++zooms in,Ctrl+0resets🤖 Generated with Claude Code