interface PageAttachmentsApi {
    add(attachments: (Blob | File)[]): FileChange;
    deleteByUuids(attachmentUuids: string[]): FileChange;
    getAddingCount(): number;
    getAll(): SmiPageFile[];
    getByUuid(attachmentUuid: string): undefined | SmiPageFile;
    getDeletingCount(): number;
    onChange(callback: ((change: FileChange) => void)): (() => void);
}

Methods

  • Adds all the attachments in the supplied array, and uploads them if possible.

    Parameters

    • attachments: (Blob | File)[]

      An array of attachments to upload.

    Returns FileChange

    The details of the file change.

  • Deletes all the attachments associated with the current page that match the UUIDs in the supplied array.

    Parameters

    • attachmentUuids: string[]

      An array of attachment UUIDs to delete.

    Returns FileChange

    A file change detail object containing an array of all the changes.

  • Returns the number of pending adds for attachments.

    Returns number

    The number of pending adds for attachments.

  • Gets all attachments associated with the current page.

    Returns SmiPageFile[]

    An array of page files.

  • Gets an attachment associated with the current page that matches the supplied UUID.

    Parameters

    • attachmentUuid: string

      The UUID of the attachment.

    Returns undefined | SmiPageFile

    Returns either a page file, or undefined.

  • Returns the number of pending deletes for attachments.

    Returns number

    The number of pending deletes for attachments.

  • The supplied callback fires when any file in the "Attachment" category changes

    Parameters

    • callback: ((change: FileChange) => void)

      The callback function.

        • (change): void
        • Parameters

          Returns void

    Returns (() => void)

    A function to remove the listener for attachments changes.

      • (): void
      • Returns void