new AttachmentViewer()
(view) Show attachment and preview if possible
- Source:
Methods
(private, static) addClipboardEventHandler()
attaches the clipboard attachment handler to the page
- Source:
(private, static) addDragDropHandler()
attaches the file attachment drag & drop handler to the page
- Source:
(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
(static) getAttachmentLink() → {jQuery}
getter for attachment link
- Source:
Returns:
- Type
- jQuery
(static) getAttachmentPreview() → {jQuery}
getter for attachment preview
- Source:
Returns:
- Type
- jQuery
(private, static) getBlobUrl(data, data) → {string}
get blob URL from string data and mime type
Parameters:
Name | Type | Description |
---|---|---|
data |
string | raw data of attachment |
data |
string | mime type of attachment |
- Source:
Returns:
objectURL
- Type
- string
(static) getFile() → {string}
getter for file data, returns the file contents
- Source:
Returns:
- Type
- string
(static) handleBlobAttachmentPreview($targetElement, file, mime)
handle the preview of files decoded to blob 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 blob URL |
mime |
string | type |
- 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:
(private, static) readFileData(loadedFile)
read file data as data URL using the FileReader API
Parameters:
Name | Type | Description |
---|---|---|
loadedFile |
object | (optional) loaded file object |
- Source:
- See:
(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: