Skip to content

Latest commit

 

History

History
156 lines (90 loc) · 3.61 KB

composeScripts.rst

File metadata and controls

156 lines (90 loc) · 3.61 KB

≡ composeScripts API

composeScripts API

This compose scripts API is the same as the content scripts API except that it works on the document of email messages during composition.

See also :ref:`executeScript <tabs.executeScript>`, :ref:`insertCSS <tabs.insertCSS>`, :ref:`removeCSS <tabs.removeCSS>`, and :doc:`messageDisplayScripts`.

Note

Registering a compose script in the manifest.json file is not possible at this point.

.. rst-class:: api-main-section

Permissions

.. api-member::
   :name: :permission:`sensitiveDataUpload`

   Transfer sensitive user data (if access has been granted) to a remote server for further processing

.. rst-class:: api-permission-info

Note

The permission compose is required to use messenger.composeScripts.*.

.. rst-class:: api-main-section

Functions

register(composeScriptOptions)

.. api-section-annotation-hack::

Register a compose script programmatically. Note: Registered scripts will only be applied to newly opened message composer tabs. To apply the script to already open message composer tab, manually inject your script by calling :ref:`tabs.executeScript` for each of the open messageCompose tabs.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``composeScriptOptions``
      :type: (:ref:`composeScripts.RegisteredComposeScriptOptions`)


.. api-header::
   :label: Required permissions

   - :permission:`compose`

.. rst-class:: api-main-section

Types

RegisteredComposeScript

.. api-section-annotation-hack::

An object that represents a compose script registered programmatically.

.. api-header::
   :label: object

   - ``unregister()`` Unregister a compose script registered programmatically.

RegisteredComposeScriptOptions

.. api-section-annotation-hack::

Details of a compose script registered programmatically.

.. api-header::
   :label: object


   .. api-member::
      :name: [``css``]
      :type: (array of :ref:`composeScripts.extensionTypes.ExtensionFileOrCode`, optional)

      The list of CSS files to inject.


   .. api-member::
      :name: [``js``]
      :type: (array of :ref:`composeScripts.extensionTypes.ExtensionFileOrCode`, optional)

      The list of JavaScript files to inject.


.. rst-class:: api-main-section

External Types

The following types are not defined by this API, but by the underlying Mozilla WebExtension code base. They are included here, because there is no other public documentation available.

ExtensionFileOrCode

.. api-section-annotation-hack::

Specify code, either by pointing to a file or by providing the code directly. Only one of the two is allowed.

.. api-header::
   :label: object


   .. api-member::
      :name: ``code``
      :type: (string)

      Some JavaScript code to register.


   .. api-member::
      :name: ``file``
      :type: (string)

      A URL starting at the extension's manifest.json and pointing to a JavaScript file to register.