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:
Name | Description | Type | Example |
actions | 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] |
newProps | 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} |
toastProps | Defines the properties that display a toast notification after the user actions. This parameter is used only with Actions.showToast. | array of IToast | [IToast] |
contextProps |
Defines the properties that update the state of the parent or child item after the event was executed:
|
array of objects | [ { "name": "accept-button", "props": {...acceptButtonProps, "isDisabled": false} } ] |
createDialogProps | 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} |
modalDialogProps | Defines the properties that display the modal window. This parameter is used only with Actions.showModal. | IModalDialog | {IModalDialog} |
postMessage | 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} |
settings | 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}" |
import {IMessage, Actions, ToastType} from "@onlyoffice/docspace-plugin-sdk"; const message: IMessage = { "actions": [Actions.showToast, Actions.closeModal], "toastProps": [ { "type": ToastType.success, "title": toastTitle, }, ], };