Plugin message

Each item which interacts with a user (onClick, onChange, onSelect, etc.) can return a message that is represented as the IMessage object with the following parameters:

Parameters
Name Description Type Example
Defines a collection of events that will be processed on the portal side. The specified actions will be performed depending on the set of values. array of Actions [Actions.showToast, Actions.closeModal]
Defines the properties that update the state of the items which interact with the users. This parameter is used only with Actions.updateProps. IInput, ICheckbox, IToggleButton, IButton, ITextArea, IComboBox {IInput}
Defines the properties that display a toast notification after the user actions. This parameter is used only with Actions.showToast. array of IToast [IToast]
Defines the properties that update the state of the parent or child item after the event was executed:
  • name - the item name,
    type: string,
    example: "accept-button";
  • props - the new properties for the parent or child item,
    type: object,
    example: {...acceptButtonProps, "isDisabled": false}.
This parameter is used only with Actions.updateContext and works in the administator or owner settings block that is embedded in the modal window with the plugin description.
array of objects [ { "name": "accept-button", "props": {...acceptButtonProps, "isDisabled": false} } ]
Defines the properties that display the default dialog box for creating a file/folder managed by the plugin. This parameter is used only with Actions.showCreateDialogModal. ICreateDialog {ICreateDialog}
Defines the properties that display the modal window. This parameter is used only with Actions.showModal. IModalDialog {IModalDialog}
Defines the properties that are used to send a message to a frame. If the frame ID is not specified or the frame with such an ID does not exist, then nothing changes. This parameter is used only with Actions.sendPostMessage. IPostMessage {IPostMessage}
Defines a parameter that is used to save and transfer the administrator or owner plugin settings to all the portal users. This parameter is used only with Actions.saveSettings. string "{settings}"
Example
import {IMessage, Actions, ToastType} from "@onlyoffice/docspace-plugin-sdk";

const message: IMessage = {
    "actions": [Actions.showToast, Actions.closeModal],
    "toastProps": [
        {
            "type": ToastType.success,
            "title": toastTitle,
        },
    ],
};