summaryrefslogtreecommitdiffstats
path: root/comm/mail/components/extensions/schemas/messageDisplayAction.json
blob: 9beda1c68e1f8184f7a63e824251c01864c5dc74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "WebExtensionManifest",
        "properties": {
          "message_display_action": {
            "type": "object",
            "additionalProperties": {
              "$ref": "UnrecognizedProperty"
            },
            "properties": {
              "default_label": {
                "type": "string",
                "description": "The label of the messageDisplayAction 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 messageDisplayAction button. This shows up in the tooltip and the label. Defaults to the add-on name.",
                "optional": true,
                "preprocess": "localize"
              },
              "default_icon": {
                "$ref": "IconPath",
                "description": "The paths to one or more icons for the messageDisplayAction 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 messageDisplayAction 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": "Currently unused.",
                "type": "string",
                "optional": true
              },
              "type": {
                "description": "Specifies the type of the button. Default type is <code>button</code>.",
                "type": "string",
                "enum": ["button", "menu"],
                "optional": true,
                "default": "button"
              }
            },
            "optional": true
          }
        }
      }
    ]
  },
  {
    "namespace": "messageDisplayAction",
    "description": "Use a messageDisplayAction to put a button in the message display toolbar. In addition to its icon, a messageDisplayAction button can also have a tooltip, a badge, and a popup.",
    "permissions": ["manifest:message_display_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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction 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 messageDisplayAction button."
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": []
          }
        ]
      },
      {
        "name": "disable",
        "type": "function",
        "description": "Disables the messageDisplayAction 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 messageDisplayAction button."
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": []
          }
        ]
      },
      {
        "name": "isEnabled",
        "type": "function",
        "description": "Checks whether the messageDisplayAction 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 messageDisplayAction button is clicked. This event will not fire if the messageDisplayAction 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
          }
        ]
      }
    ]
  }
]