availableAttachments Property

Description

This property defines the attachments that are available in the editor. This property is an array of attachment definition objects. Each of these objects has two properties, an id and a label. The id uniquely identifies the attachment. The label is text that will be included with the attachment symbol when the attachment is added to a diagram.

The symbols defined in this property are used in conjunction with the addDocumentAttachmentSymbol, addImageAttachmentSymbol and addVideoAttachmentSymbol commands. See the executeCommand() method.

The host application can register an event handler that is fired when an attachment reference symbol is clicked on. See showAttachment event for more information.

You can also get attachment positions when exporting your image as a diagram. See getAttachmentPositionsInExpImage method for more information.

Setting of this property also accomplishes deletion of attachment symbols from the diagram. If an attachment symbol has been added to the diagram that is not in the array of available attachments it will be deleted.

Note — This property may be set only after the startup() method has been called. Failure to do so will result in an exception.

To set the value of this property, use the set method of the ESDWeb object as illustrated below.

Example

editor = new window.__editor(undefined, document.getElementById('editor-node'));

/* set other properties here */

editor.startup(...);

editor.set('availableAttachments', [
    {
        id: 'id1',
        label: 'Attachment One'
    },
    {
        id: 'id2',
        label: 'Attachment Two'
    }
]);