Editor Buttons Module
Dette indhold er ikke tilgængeligt i dit sprog endnu.
Translate in CrowdinThis module allows adding buttons to the Editor that act on another module of the same app.
Editor button locations:
header-right: the upper-right corner of the Editor headerheader-left: the upper-left corner of the Editor headermenu: the Apps menu in the Editor’s main menutranslation-toolbar: the toolbar with the actions for the current translationstrings-menu: the menu of the currently selected string or strings
A button can perform one of the following actions:
- Open a specified app module in the Editor’s right panel (see Editor Right Panel module)
- Open a specified app module in a modal dialog (see Modal module)
- Send an
editor.button.clickevent to a specified app module
The panel and modal types are available at every location. The event type is available at the translation-toolbar and strings-menu locations.
The header locations and the translation toolbar show up to four buttons each, and the rest are available in the More app actions dropdown. In the assets mode, buttons are available at the header-right, header-left, and menu locations.
Editor buttons are also listed in the Editor’s Command Palette, and each of them can be assigned a keyboard shortcut in Help > Keyboard Shortcuts.
You can grant access to this module to one of the following user categories:
For Crowdin:
- Only me (i.e., project owner)
- Me, project managers and developers
- All project members
- Selected users
For Crowdin Enterprise:
- Only organization admins
- Organization admins, project managers and developers
- All users in the organization projects
- Selected users
The button opens the specified module in the Editor’s right panel.
{ "modules": { "editor-button": [ { "key": "editor-button-key", "name": "Name of Editor Button", "logo": "/editor-button-logo.png", "modes": [ "translate" ], "options": { "location": "header-right", "type": "panel", "module": "editor-panel-module-key", "weight": 10 } } ], "editor-right-panel": [ { "key": "editor-panel-module-key", "name": "New Panel", "modes": [ "translate" ], "url": "/editor-page" } ] }}The button opens the specified module in a modal dialog.
{ "modules": { "editor-button": [ { "key": "editor-button-key", "name": "Name of Editor Button", "modes": [ "translate" ], "options": { "location": "menu", "type": "modal", "module": "modal-module-key" } } ], "modal": [ { "key": "modal-module-key", "name": "New Modal", "url": "/path/to/modal/module" } ] }}The button sends an editor.button.click event to the specified module without opening it.
{ "modules": { "editor-button": [ { "key": "editor-button-key", "name": "Name of Editor Button", "modes": [ "translate" ], "options": { "location": "translation-toolbar", "type": "event", "module": "editor-panel-module-key" } } ], "editor-right-panel": [ { "key": "editor-panel-module-key", "name": "New Panel", "modes": [ "translate" ], "url": "/editor-page" } ] }}The event payload depends on the button’s location. See Supported Events for the object structure.
key | Type: Required: yes Description: Module identifier within the Crowdin app. |
name | Type: Required: yes Description: The human-readable name displayed in the button’s tooltip, and as the item label in the menus. |
logo | Type: Description: The relative URL to the button’s icon. |
modes | Type: Required: yes Allowed values: Description: The Editor’s mode list where the module will be available. |
options.location | Type: Required: yes Allowed values: Description: The location in the Editor where the button is added. |
options.type | Type: Required: yes Allowed values: Description: The type of action this button will perform. |
options.module | Type: Required: yes Description: The |
options.weight | Type: Description: The order of the button among the other buttons at the same location. Buttons with lower values are placed first: to the left in the header and the translation toolbar, and higher in the menus. |
environments | Type: Allowed values: Description: Set of environments where a module could be installed. |
An app can update its own buttons while the Editor is open: set the icon, add a badge, override the tooltip, or make a button inactive. Use the AP.editor.updateButton method to apply the changes and AP.editor.resetButton to return the button to the state declared in the manifest.