API Docs for: 1.0.0
Show:

eZ.MediaEditView Class

The Media edit view

Constructor

Methods

_afterRender

() protected

Method called at the end of the render process. The default implementation does nothing, it is meant to be overridden in the view extending the binary base edit view.

_base64ToFileStruct

(
  • e
  • file
)
protected

Set the file attribute with a struct based on the file object from the input file element.

Parameters:

  • e EventFacade

    event facade

  • file File

    the File object from the input file element

_beforeReadFile

() protected

Removes the being updated and unsupported class before reading the content of the file

_chooseFile

(
  • e
)
protected

Event handler for the tap event on the upload button

Parameters:

_completeFieldValue

(
  • fieldValue
)
Object protected

Completes the field value with the player settings

Parameters:

  • fieldValue Object

Returns:

Object:

_createFileStruct

(
  • file
  • content
)
Object protected

Creates the file structure based on the File object provided by the input file and on the base64 encoded binaryfile content. It also creates a blob URL for the newly selected object.

Parameters:

  • file File
  • content String

    base64 encoded binaryfile content

Returns:

Object:

_drop

(
  • e
)
protected

Event handler for the drop DOM event.

Parameters:

_fileSetter

(
  • value
)
Object protected

file attribute setter. It converts the different input type to a consistent object no matter if the file attribute is filled from the REST fieldValue or from the user input.

Parameters:

  • value Object | Null

Returns:

Object:

_getFieldValue

() Object | Null | Undefined protected

Returns the field value suitable for the REST API based on the current input. It makes to sure to only send the actual content when it's needed. It returns null if no file has been chosen yet or undefined if no change happened since the version save event.

Returns:

Object | Null | Undefined:

_getHumanMaxSize

() String protected

Returns a "human" readable version of the max allowed file size

Returns:

String:

_getOverSizeMessage

(
  • name
)
String protected

Returns the warning message suitable when the user tries to use a too big file

Parameters:

  • name String

    the filename the user wants to use

Returns:

String:

_getPlayerNode

() Node private

Returns the video/audio node

Returns:

Node:

_hideWarning

(
  • e
)
protected

Event handler for the tap event on the hide link of the warning box.

Parameters:

_isCreatingTranslation

() Boolean protected

Check if a new translation is being created.

Returns:

Boolean:

_isEmpty

() Boolean protected

Checks whether the file field is currently empty.

Returns:

Boolean:

_maxSize

() protected

Returns the maximum allowed size in bytes or 0 if no limit is set.

Returns:

Number

_mediaError

(
  • player
)

Adds the unsupported class and resets the width/height placeholder when the file can not read by the browser

Parameters:

  • player Node

    the video/audio node

_prepareDrop

(
  • e
)
protected

Event handler for the dragenter and dragover DOM event

Parameters:

_readFile

(
  • file
)
protected

Read the content of the choosen File (if its size match the field configuration) and update the file attribute with the corresponding structure

Parameters:

  • file File

    the File object from the input file element

_removeBinaryFile

(
  • e
)
protected

Event handler for the tap event on the remove button

Parameters:

_setStateClasses

() protected

Set the state classes on the view container

_toggleClass

(
  • Mixed
  • cl
)
private

Toggle a class on the view container based on the value

Parameters:

  • Mixed Object

    value

  • cl String

    the class to toggle

_trackVersionSave

() private

Sets the updated attribute to false when the attached version is saved. This is to avoid sending again and again the same file

_uiBinaryFileChange

(
  • e
)
protected

Reflects the new binaryfile object in the generated UI

Parameters:

_uiHandleWarningMessage

() protected

warningChange event handler, it displays/hides the warning message depending on the attribute value.

_uiPrepareDropArea

(
  • the
)
protected

Prepares visually the drop area

Parameters:

_uiResetDropArea

() protected

Resets visually the drop area

_updateFile

(
  • e
)
protected

Event handler for the change event on the file input

Parameters:

_updateSetting

(
  • e
)

Event handler for the DOM change event on the controller, autoplay and loop checkboxes.

Parameters:

_updateSize

(
  • e
)

Event handler the valuechange event on the width and height input

Parameters:

_updateWidthHeightPlaceholder

(
  • widthValue
  • heightValue
)

Sets the placeholder attribute on the width and height input with the given values

Parameters:

_valid

(
  • file
)
protected

Checks whether the File in parameter is valid for the field. By default, only the size of the file is checked against the maximum allowed file size.

Parameters:

  • file File

    the File object to be stored in the field

Returns:

Boolean

_validSize

(
  • file
)
Boolean private

Checks whether the size is valid according to the field definition configuration. If the file can not be accepted, a warning message is set in the warning attribute.

Parameters:

  • file File

    the File object to be stored in the field

Returns:

Boolean:

_variables

() Object protected

Defines the variables to be imported in the field edit template.

Returns:

Object:

_watchPlayerEvents

() protected

Sets the event handler on the video/audio element to handle the being updated state, the width/height placeholder and a potential file format error

validate

()

Validates the current input of the image against the is required field definition setting.

Attributes

autoplay

Boolean readonly

Stores the autoplay setting

Default: false

file

Object | Null readonly

The file struct object for the current field. This attribute has a setter to accept either null value, any REST fieldValue or an object created from a File.

fileReader

FileReader readonly

FileReader instance

hasController

Boolean readonly

Stores the hasController setting

Default: false

height

Number readonly

Stores the height setting

loop

Boolean readonly

Stores the loop setting

Default: false

updated

Boolean readonly

Flag indicating whether the user changed something in the binaryfile field. This attribute is used to avoid sending the same binaryfile again and again.

warning

String | False readonly

Stores the warning message (if any) or false

width

Number readonly

Stores the width setting