pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

Add support for configuring Snippet Shortcut Menu shortcut

Open twschiller opened this issue 1 year ago • 1 comments

User Story

  • As a mod end-user, I want to configure the Snippet Shortcut Menu command key so it won't conflict with other applications I use

Motivation

  • Intercom uses \ https://pixiebrix.slack.com/archives/C042CA15AKS/p1712263410665629
  • Kustomer users \ for toggling their insights sidebar. (Might not toggle when typing in a text field?)
  • Grammarly also uses \ for their snippet affordance

Discussion

  • UX: our settings page is currently all toggles except for Advanced Settings
  • Advanced Settings does not provide any visual indication that the setting has been applied
  • @BrandonPxBx what do you recommend we use for indicators, e.g.:
    • Toast
    • Show an green highlight or success animation on the field
  • Do we want to use a createable select field so we can suggest other triggers they might likely want to use, e.g., \, >?
  • We should consider showing the currently configuring quick bar shortcut in that card too and provide a link to browser settings to change the shortcut

Out of Scope

  • Support key combinations, e.g., Shift + >. Our Snippet Shortcut Menu currently assumes that the character and shortcut query will be written in the field
  • Do we want to put this configuration in the Admin Console instead of Extension Console? It probably makes sense to put in Extension Console for now. But syncing settings would be beneficial in the future

Acceptance Criteria

  • The Extension Console > Settings > General Settings screen includes a field for configuring the Snippet Shortcut menu
  • Field:
    • Title: Snippet Shortcut Key
    • Description: The keyboard key to open Snippet Shortcut Menu in text editors
    • Default Value: \
    • Validation: field should only accept a single non-whitespace character
  • Snippet Shortcut Menu changed to look for the character specified
  • Nice to have: listen for changes to settings storage to change the shortcut on open tabs

Related Code

  • The value is hard-coded in a couple locations: https://github.com/pixiebrix/pixiebrix-extension/blob/733719b0a8f55f9f3160b0279b09a103714edc36/src/contentScript/shortcutSnippetMenu/shortcutSnippetMenuController.tsx#L49-L49

twschiller avatar Apr 05 '24 13:04 twschiller