-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the
commands
sample to have 2 commands
Before the change, the sample showed how to add one command, and how to update it, reset it, and respond to it. But usually the extension developer needs to configure more than one command, and the code was not readily usable for such a need. After this patch, the developer can easily see what are the different places they need to make conditional decisions, to add a new command to the extension. This patch also includes some cosmetic changes, like wrapping the long lines of the README.md, as intended by the authors of Markdown syntax. If desirable, I can put such cosmetic changes in a separate commit.
- Loading branch information
Showing
5 changed files
with
93 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
# commands | ||
|
||
This extension shows how to use the `commands` manifest key to register keyboard shortcuts for your extension. | ||
This extension shows how to use the `commands` manifest key to register keyboard | ||
shortcuts for your extension. | ||
|
||
It registers a shortcut (Ctrl+Shift+U) to send a command to the extension (Command+Shift+U on a Mac). | ||
When the user enters the shortcut, the extension opens a new browser tab and loads https://developer.mozilla.org into it. | ||
It registers a shortcut (Ctrl+Shift+U) to send a command to the extension | ||
(Command+Shift+U on a Mac). When the user enters the shortcut, the extension | ||
opens a new browser tab and loads https://developer.mozilla.org into it. | ||
|
||
It also adds an [options page](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/user_interface/Options_pages) to the extension, which enables the user to change the registered shortcut for the extension. Just open the options page, then type a new value into the textbox (for example: "Ctrl+Shift+O") and press "Update keyboard shortcut". To reset the shortcut to its original value, press "Reset keyboard shortcut". | ||
The extension has another command, that opens the https://addons.mozilla.org in | ||
a new tab. This command does not have a predefined shortcut assigned to it. The | ||
user can assign a shortcut of her choosing to this command. | ||
|
||
It also adds an [options page][] to the extension, which enables the user to | ||
change the registered shortcuts for the extension. Just open the options page, | ||
then type a new value into the textboxes (for example: "Ctrl+Shift+O") and press | ||
"Update keyboard shortcuts". To reset all the shortcuts to thier original value, | ||
press "Reset keyboard shortcuts". | ||
|
||
[options page]: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/user_interface/Options_pages |
This file contains 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
This file contains 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
This file contains 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
This file contains 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