Class: AttachmentViewer

AttachmentViewer()

new AttachmentViewer()

(view) Show attachment and preview if possible
Source:

Methods

(static) clearDragAndDrop()

Cleares the drag & drop data.
Source:

(static) getAttachment() → {array}

return the attachment
Source:
Returns:
Type
array

(static) getAttachmentData() → {jQuery}

getter for attachment data
Source:
Returns:
Type
jQuery
getter for attachment link
Source:
Returns:
Type
jQuery

(static) getAttachmentPreview() → {jQuery}

getter for attachment preview
Source:
Returns:
Type
jQuery

(static) getFile() → {string}

getter for file data, returns the file contents
Source:
Returns:
Type
string

(static) handleAttachmentPreview($targetElement, file)

handle the preview of files that can either be an image, video, audio or pdf element
Parameters:
Name Type Description
$targetElement jQuery element where the preview should be appended
file string as a data URL
Source:

(static) hasAttachment()

checks if there is an attachment displayed
Source:

(static) hasAttachmentData()

checks if there is attachment data (for preview!) available It returns true, when there is data that needs to be encrypted.
Source:

(static) hideAttachment()

hides the attachment This will not hide the preview (see AttachmentViewer.hideAttachmentPreview for that) nor will it hide the attachment link if it was moved somewhere else (see AttachmentViewer.moveAttachmentTo).
Source:

(static) hideAttachmentPreview()

hides the attachment preview
Source:

(static) init()

initiate preloads jQuery elements
Source:

(static) moveAttachmentTo($element, label)

moves the attachment link to another element It is advisable to hide the attachment afterwards (AttachmentViewer.hideAttachment)
Parameters:
Name Type Description
$element jQuery the wrapper/container element where this should be moved to
label string the text to show (%s will be replaced with the file name), will automatically be translated
Source:

(static) removeAttachment()

removes the attachment This automatically hides the attachment containers too, to prevent an inconsistent display.
Source:

(static) removeAttachmentData()

removes the attachment data This removes the data, which would be uploaded otherwise.
Source:

(static) setAttachment(attachmentData, fileName)

sets the attachment but does not yet show it
Parameters:
Name Type Description
attachmentData string base64-encoded data of file
fileName string optional, file name
Source:

(static) showAttachment()

displays the attachment
Source: