fix(intent-editor): save on Cmd+S instead of triggering browser save-page#6296
Merged
Conversation
…page The Intent Editor's $scope.save took no arguments and never called preventDefault(), so the platform `shortcut` directive (which passes `(keySet, event)` and deliberately leaves preventDefault to the action) let the browser's native "Save page" dialog fire on Cmd+S/Ctrl+S. This was most visible right after accepting an AI-assistant proposal, which dirties the buffer without the user typing. Adopt the repo-standard save signature already used by editor-csv, editor-csvim and editor-integrations: accept `(keySet, event)` and `event?.preventDefault()` first. The defaulted params keep the toolbar Save button and the save-all/save-file hub handlers (which call save() with no args) working unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Fixes an annoying behaviour in the Intent Editor: pressing Cmd+S / Ctrl+S did not save the
app.intentfile — instead the browser's native "Save page" dialog appeared.Why
Cmd+S is wired through the platform
shortcutdirective on the editor body (shortcut="'ctrl+s'" shortcut-action="save"). That directive invokesshortcut.action(keySet, event)but deliberately does not callevent.preventDefault()itself — suppressing the browser default is the action's responsibility.The Intent Editor's
$scope.savewas declared as() => {…}: it took no event and never calledpreventDefault(), so the browser default fired. This was most visible right after accepting an AI-assistant proposal, which dirties the buffer without the user typing — the buffer was genuinely dirty, the keydown just wasn't intercepted.Every sibling blimpKit editor that uses the same directive (
editor-csv,editor-csvim,editor-integrations) already does it correctly. The Intent Editor was the lone outlier.Change
One-line signature change to the repo-standard pattern:
The defaulted parameters keep the toolbar Save button (
ng-click="save()") and theworkspaceHub.onSaveAll/onSaveFilehub handlers (which callsave()with no args) working unchanged — only theshortcutdirective passes(keySet, event).Testing
Verified locally: open a project's
app.intent, use the AI assistant, click Accept on a proposal (buffer goes dirty), press Cmd+S — the file saves silently, no download dialog. Plain typing edits + Cmd+S and the toolbar Save button also confirmed working.🤖 Generated with Claude Code