Skip to content

Feature Request: Save Snippet via Keyboard Shortcut (Ctrl + S) #14

Description

@kp348

⚠️ Competition Only
This issue was created exclusively for participants of SourceSprint'26, an open-source competition held at VIT Vellore.
Pull requests submitted for this issue will only be accepted from registered SourceSprint'26 participants. Pull requests from others will be closed without review.

Description

When adding or editing a snippet in the modal window, users naturally want to press Ctrl + S (or Cmd + S) to save the work. Right now, doing this triggers the browser's default "Save Page As" dialog. We need to intercept this shortcut to save the snippet instead, but only when the modal is open.

Expected Behavior

  • When the snippet modal is open, pressing Ctrl + S or Cmd + S should trigger the saveSnippet() function.
  • The browser's default "Save HTML Page" prompt must be strictly blocked.
  • If the modal is not open, Ctrl + S should be ignored by our script, allowing the standard browser behavior.
  • If the required fields (Title, Category, Code) are empty when the shortcut is pressed, the native form validation should still trigger, exactly as it does when clicking the "Save Snippet" button.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions