Version 2.4.0
Date: 20-Sep-2014
- (enh #33): Better text format validation and correct modal preview.
- (enh #32): Added checks for file api support.
- (enh #31): Better control and configuration of preview templates.
- (enh #30): Enhanced generic support for more preview formats (audio, video, html, flash, and other objects).
Note: There are BC Breaking Changes with release v2.4.0.
With release v2.4.0, the plugin has been revamped to support and configure a wide variety of file formats for preview. This may break some
backward compatibility (BC) for older versions that use custom templates.
The following are the major changes with release v2.4.0:
- Plugin has been revamped to build preview intelligence based on various file preview types. The inbuilt file support types are categorized as
image
,text
,html
,video
,audio
,flash
,object
, andother
. allowedPreviewTypes
: You can now configure which all file types are allowed to be shown as a preview. This defaults to['image', 'html', 'text', 'video', 'audio', 'flash', 'object']
.
Thus all file types are treated as an object to preview by default. For exampleTo preview onlyimage
andvideo
, you can set this to['image', 'video']
.allowedPreviewMimeTypes
: In addition toallowedPreviewTypes
, you can also control which all mime types can be displayed for preview. This defaults to null,
meaning all mime types are supported.layoutTemplates
: Allows you to configure all layout template settings within one property. The layout objects that can be configured are:main1
,main2
,
preview
,caption
, andmodal
.previewTemplates
: All preview templates for each preview type have been combined into one property, instead of separate templates for image, text etc.
The keys are the formats as set inallowedPreviewTypes
and values are the templates used for previewing. There are default prebuilt templates for each
preview file type (generic
,image
,text
,html
,video
,audio
,flash
,object
, andother
). Thegeneric
template is used only for displaying
initialPreview
content using direct markup.previewSettings
: Allows you to configure width and height for each preview image type. The plugin has default widths and heights predefined for each type i.e
image
,text
,html
,video
,audio
,flash
, andobject
.fileTypeSettings
: Allows you to configure and identify each preview file type using a callback. The plugin has default callbacks predefined to identify each type i.e
image
,text
,html
,video
,audio
,flash
, andobject
.- Replacing tags within templates has been enhanced. With this release it will automatically check for multiple occurrences of each tag to replace within a template string.
NOTE: Flash preview will require Shockwave flash to be installed and supported by the client browser. The flash preview currently works successfully with webkit browsers only. Video & Audio formats are however supported by all modern browsers
that support the HTML5video
/audio
tags. Note that browsers have limited number of video/audio formats supported by the HTML5 video element (e.g. mp4, webm, ogg, mp3, wav). The size of video files are recommended to be small (to be controlled
throughmaxFileSize
property) so that it does not affect the preview performance. You can copy a few files from theexamples
directory of this plugin repo, to test a few examples of flash and video files.