Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Keyboard Shortcut? #13

Closed
ibehnam opened this issue Jul 20, 2022 · 10 comments
Closed

[Suggestion] Keyboard Shortcut? #13

ibehnam opened this issue Jul 20, 2022 · 10 comments

Comments

@ibehnam
Copy link

ibehnam commented Jul 20, 2022

This extension is exactly what I was looking for! Thanks for doing this. I was wondering if we can assign shortcut keys to insert Github Gists using this extension? Medium already has some for text (e.g., CMD+OPTION+1 => Heading 1). It'd be nice to have something like CMD+OPT+0 => Insert Gist.

@Maluen
Copy link
Owner

Maluen commented Jul 20, 2022

This does indeed looks nice to have. I think the user should be able to customize the shortcut, maybe even keeping "CMD/CTRL + OPTION" and just changing "1" with other keys.

The customization could be done in the extension button popup.

The user should also know that they can use the shortcut, so the info should be added somewhere, in the list of features but also potentially in the gist editor as a tip.

@ibehnam
Copy link
Author

ibehnam commented Jul 22, 2022

Yes, that all sounds good!

If it's not possible to do, there's always the option of assigning shortcuts in the browser (e.g., in Brave you can assign shortcuts to extensions, but the extension has to provide the list of its functionalities, see the Dark Reader example).

For example, the following doesn't work:
image

But this one works:
image

@Maluen
Copy link
Owner

Maluen commented Jul 23, 2022

Added shortcut with default "CTRL/CMD + SHIFT + 0".

I didn't use "CTRL/CMD + ALT/OPT + 0" since chrome allows either "CTRL" or "ALT". See https://developer.chrome.com/docs/extensions/reference/commands/#key-combinations

If another extension is already using the same combination, the shortcut will be unset and must be manually changed. This can be confusing for an end user. For this chrome docs suggest notifying the user on installation, example: https://developer.chrome.com/docs/extensions/reference/commands/#verify-commands-registered

For now no notification is being shown.

@Maluen
Copy link
Owner

Maluen commented Jul 23, 2022

I've changed the default to "ALT + SHIFT + 0" as the old one triggered zoom in Firefox, also other "CTRL + SHIFT" combinations are bound to firefox's own shortcuts.

@Maluen
Copy link
Owner

Maluen commented Jul 23, 2022

Also the shortcut will only work when the Medium Editor toolbar is active, that is when the cursor is on a new line (most of the time this also means the "+" is visible):

image

Otherwise it wouldn't add the gist anyway after typing it.

Maluen added a commit that referenced this issue Jul 23, 2022
@ibehnam
Copy link
Author

ibehnam commented Jul 24, 2022

Thanks @Maluen for this! I haven't got the chance to download the files to update the extension yet, and the one on the Chrome store (and the release page here) is outdated. I'll give it a shot first chance I get and will let you know how it is.

@Maluen
Copy link
Owner

Maluen commented Jul 24, 2022

@ibehnam I didn't release yet, but you can build from source to test latest commits. See https://github.com/Maluen/code-medium#building-manually the generated folder can be loaded as an "unpacked extension" in chrome/firefox.

@ibehnam
Copy link
Author

ibehnam commented Jul 24, 2022 via email

@Maluen
Copy link
Owner

Maluen commented Jul 24, 2022

@ibehnam the folder to load is dist/chrome (in Chrome) or dist/firefox (in Firefox), which is generated by following https://github.com/Maluen/code-medium#building-manually

@Maluen
Copy link
Owner

Maluen commented Apr 16, 2024

Done, included in v0.6.0

@Maluen Maluen closed this as completed Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants