Revision control

Copy as Markdown

Other Tools

[
{
"namespace": "manifest",
"types": [
{
"$extend": "WebExtensionManifest",
"properties": {
"compose_action": {
"type": "object",
"additionalProperties": {
"$ref": "UnrecognizedProperty"
},
"properties": {
"default_label": {
"type": "string",
"description": "The label of the composeAction button, defaults to its title. Can be set to an empty string to not display any label. If the containing toolbar is configured to display text only, the title will be used as fallback.",
"optional": true,
"preprocess": "localize"
},
"default_title": {
"type": "string",
"description": "The title of the composeAction button. This shows up in the tooltip and the label. Defaults to the add-on name.",
"optional": true,
"preprocess": "localize"
},
"default_icon": {
"$ref": "manifest.IconPath",
"description": "The paths to one or more icons for the composeAction button.",
"optional": true
},
"theme_icons": {
"type": "array",
"optional": true,
"minItems": 1,
"items": {
"$ref": "ThemeIcons"
},
"description": "Specifies dark and light icons to be used with themes. The ``light`` icon is used on dark backgrounds and vice versa. **Note:** The default theme uses the ``default_icon`` for light backgrounds (if specified)."
},
"default_popup": {
"type": "string",
"format": "relativeUrl",
"optional": true,
"description": "The html document to be opened as a popup when the user clicks on the composeAction button. Ignored for action buttons with type <value>menu</value>.",
"preprocess": "localize"
},
"browser_style": {
"type": "boolean",
"optional": true,
"description": "Enable browser styles. See the `MDN documentation on browser styles <|link-mdn-browser-styles|>`__ for more information.",
"default": false
},
"default_area": {
"description": "Defines the location the composeAction button will appear. The default location is <value>maintoolbar</value>.",
"type": "string",
"enum": ["maintoolbar", "formattoolbar"],
"optional": true
},
"type": {
"description": "Specifies the type of the button. Default type is <value>button</value>.",
"type": "string",
"enum": ["button", "menu"],
"optional": true,
"default": "button"
}
},
"optional": true
}
}
}
]
},
{
"namespace": "composeAction",
"description": "Use a composeAction to put a button in the message composition toolbars. In addition to its icon, a composeAction button can also have a tooltip, a badge, and a popup.",
"permissions": ["manifest:compose_action"],
"types": [
{
"id": "ColorArray",
"description": "An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is <value>[255, 0, 0, 255]</value>.",
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 4,
"maxItems": 4
},
{
"id": "ImageDataType",
"type": "object",
"isInstanceOf": "ImageData",
"additionalProperties": {
"type": "any"
},
"postprocess": "convertImageDataToURL",
"description": "Pixel data for an image. Must be an |ImageData| object (for example, from a |Canvas| element)."
},
{
"id": "ImageDataDictionary",
"type": "object",
"description": "A <em>dictionary object</em> to specify multiple |ImageData| objects in different sizes, so the icon does not have to be scaled for a device with a different pixel density. Each entry is a <em>name-value</em> pair with <em>value</em> being an |ImageData| object, and <em>name</em> its size. Example: <literalinclude>includes/ImageDataDictionary.json<lang>JavaScript</lang></literalinclude>See the `MDN documentation about choosing icon sizes <|link-mdn-icon-size|>`__ for more information on this.",
"patternProperties": {
"^[1-9]\\d*$": {
"$ref": "ImageDataType"
}
}
},
{
"id": "OnClickData",
"type": "object",
"description": "Information sent when a composeAction button is clicked.",
"properties": {
"modifiers": {
"type": "array",
"items": {
"type": "string",
"enum": ["Shift", "Alt", "Command", "Ctrl", "MacCtrl"]
},
"description": "An array of keyboard modifiers that were held while the menu item was clicked."
},
"button": {
"type": "integer",
"optional": true,
"description": "An integer value of button by which menu item was clicked."
}
}
}
],
"functions": [
{
"name": "setTitle",
"type": "function",
"description": "Sets the title of the composeAction button. Is used as tooltip and as the label.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"title": {
"choices": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A string the composeAction button should display as its label and when moused over. Cleared by setting it to <value>null</value> or an empty string (title defined the manifest will be used)."
},
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Sets the title only for the given tab."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "getTitle",
"type": "function",
"description": "Gets the title of the composeAction button.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Specifies for which tab the title should be retrieved. If no tab is specified, the global value is retrieved."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "result",
"type": "string"
}
]
}
]
},
{
"name": "setLabel",
"type": "function",
"description": "Sets the label of the composeAction button. Can be used to set different values for the tooltip (defined by the title) and the label. Additionally, the label can be set to an empty string, not showing any label at all.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"label": {
"choices": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A string the composeAction button should use as its label, overriding the defined title. Can be set to an empty string to not display any label at all. If the containing toolbar is configured to display text only, its title will be used. Cleared by setting it to <value>null</value>."
},
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Sets the label only for the given tab."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "getLabel",
"type": "function",
"description": "Gets the label of the composeAction button.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Specifies for which tab the label should be retrieved. If no tab is specified, the global label is retrieved."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "result",
"type": "string",
"optional": true
}
]
}
]
},
{
"name": "setIcon",
"type": "function",
"description": "Sets the icon for the composeAction button. Either the ``path`` or the ``imageData`` property must be specified.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"imageData": {
"choices": [
{
"$ref": "ImageDataType"
},
{
"$ref": "ImageDataDictionary"
}
],
"optional": true,
"description": "The image data for one or more icons for the composeAction button."
},
"path": {
"$ref": "manifest.IconPath",
"optional": true,
"description": "The paths to one or more icons for the composeAction button."
},
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Sets the icon only for the given tab."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "setPopup",
"type": "function",
"description": "Sets the html document to be opened as a popup when the user clicks on the composeAction button.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"popup": {
"choices": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The html file to show in a popup. Can be set to an empty string to not open a popup. Cleared by setting it to <value>null</value> (action will use the popup value defined in the manifest)."
},
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Sets the popup only for the given tab."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "getPopup",
"type": "function",
"description": "Gets the html document set as the popup for this composeAction button.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Specifies for which tab the popup document should be retrieved. If no tab is specified, the global value is retrieved."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "result",
"type": "string"
}
]
}
]
},
{
"name": "setBadgeText",
"type": "function",
"description": "Sets the badge text for the composeAction button. The badge is displayed on top of the icon.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"text": {
"choices": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Any number of characters can be passed, but only about four can fit in the space. Cleared by setting it to <value>null</value> or an empty string."
},
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Sets the badge text only for the given tab."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "getBadgeText",
"type": "function",
"description": "Gets the badge text of the composeAction button.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Specifies for which tab the badge text should be retrieved. If no tab is specified, the global label is retrieved."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "result",
"type": "string"
}
]
}
]
},
{
"name": "setBadgeBackgroundColor",
"type": "function",
"description": "Sets the background color for the badge.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"color": {
"choices": [
{
"type": "string"
},
{
"$ref": "ColorArray"
},
{
"type": "null"
}
],
"description": "The color to use as background in the badge. Cleared by setting it to <value>null</value> or an empty string."
},
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Sets the background color for the badge only for the given tab."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "getBadgeBackgroundColor",
"type": "function",
"description": "Gets the badge background color of the composeAction button.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Specifies for which tab the badge background color should be retrieved. If no tab is specified, the global label is retrieved."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "result",
"$ref": "ColorArray"
}
]
}
]
},
{
"name": "enable",
"type": "function",
"description": "Enables the composeAction button for a specific tab (if a ``tabId`` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well. By default, a composeAction button is enabled.",
"async": "callback",
"parameters": [
{
"type": "integer",
"optional": true,
"name": "tabId",
"minimum": 0,
"description": "The id of the tab for which you want to modify the composeAction button."
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "disable",
"type": "function",
"description": "Disables the composeAction button for a specific tab (if a ``tabId`` is provided), or for all tabs which do not have a custom enable state. Once the enable state of a tab has been updated individually, all further changes to its state have to be done individually as well.",
"async": "callback",
"parameters": [
{
"type": "integer",
"optional": true,
"name": "tabId",
"minimum": 0,
"description": "The id of the tab for which you want to modify the composeAction button."
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "isEnabled",
"type": "function",
"description": "Checks whether the composeAction button is enabled.",
"async": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"tabId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "Specifies for which tab the state should be retrieved. If no tab is specified, the global value is retrieved."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"unsupported": true,
"description": "Will throw an error if used."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"type": "boolean"
}
]
}
]
},
{
"name": "openPopup",
"type": "function",
"description": "Opens the action's popup window in the specified window. Defaults to the current window. Returns false if the popup could not be opened because the action has no popup, is of type <value>menu</value>, is disabled or has been removed from the toolbar.",
"async": "callback",
"parameters": [
{
"name": "options",
"optional": true,
"type": "object",
"description": "An object with information about the popup to open.",
"properties": {
"windowId": {
"type": "integer",
"minimum": -2,
"optional": true,
"description": "Defaults to the current window."
}
}
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"type": "boolean"
}
]
}
]
}
],
"events": [
{
"name": "onClicked",
"type": "function",
"description": "Fired when a composeAction button is clicked. This event will not fire if the composeAction has a popup. This is a user input event handler. For asynchronous listeners some `restrictions <|link-user-input-restrictions|>`__ apply.",
"parameters": [
{
"name": "tab",
"$ref": "tabs.Tab"
},
{
"name": "info",
"$ref": "OnClickData",
"optional": true
}
]
}
]
}
]