Repository navigation
fix(viewer): no overlapping saves, Ctrl+S saves wherever the focus is - #459
Merged
Merged
Conversation
Autosave runs every 10 seconds next to the save button and Ctrl+S. When two saves overlapped, the second request still carried the old mtime and failed with "The file you are working on was updated in the meantime", although nobody else had touched the file. A save requested while one is running now waits for it and runs afterwards, so edits made in between are saved as well and a pending close still gets its answer. The map is marked unchanged when the request goes out and changed again when it fails, so edits made during a save are no longer lost. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Inside the editor, Ctrl+S was handled in the bubble phase, where the editor's own key handlers could swallow it first. It is now handled in the capture phase and checks event.key instead of the deprecated event.which. With the focus outside the editor iframe, for example on the viewer's header, Ctrl+S opened the browser's save dialog. The viewer element now catches it while it is shown and asks the editor to save. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 task done
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.
Two save fixes in the editor, taken from the analysis of #259 (thanks @stephancordes for the diagnosis).
event.keyinstead of the deprecatedevent.which. With the focus outside the editor iframe, for example on the viewer header, Ctrl+S opened the browser's save dialog; the viewer element now catches it while it is shown and asks the editor to save.Unlike #259, the parent-side handler doesn't pull a logger into the init script, which runs on every page.
Checked: unit tests (117 passing, 3 new for the viewer element's Ctrl+S), lint, production build. Not yet tested on a live instance.
The 0.1.x backport follows in a separate PR, with the Ctrl+S handling adapted to the Vue component used there.
🤖 AI (if applicable)