Report an issue
Class

CKEDITOR.ui.dialog.file

class

A file upload input.

Filtering

Properties

  • inherited

    eventProcessors : Object

    The event processor list used by getInputElement at UI element instantiation. The default list defines three on* events:

    1. onLoad - Called when the element's parent dialog opens for the first time.
    2. onShow - Called whenever the element's parent dialog opens.
    3. onHide - Called whenever the element's parent dialog closes.

      // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick // handlers in the UI element's definitions. CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, { onClick : function( dialog, func ) { this.on( 'click', func ); } }, true );

Methods

  • inherited

    constructor( dialog, elementDefinition, htmlList, [ nodeNameArg ], [ stylesArg ], [ attributesArg ], [ contentsArg ] ) → uiElement

    Creates a uiElement class instance.

    Parameters

    dialog : dialog

    Parent dialog object.

    elementDefinition : uiElement

    Element definition.

    Accepted fields:

    • id (Required) The id of the UI element. See CKEDITOR.dialog.getContentElement.
    • type (Required) The type of the UI element. The value to this field specifies which UI element class will be used to generate the final widget.
    • title (Optional) The popup tooltip for the UI element.
    • hidden (Optional) A flag that tells if the element should be initially visible.
    • className (Optional) Additional CSS class names to add to the UI element. Separated by space.
    • style (Optional) Additional CSS inline styles to add to the UI element. A semicolon (;) is required after the last style declaration.
    • accessKey (Optional) The alphanumeric access key for this element. Access keys are automatically prefixed by CTRL.
    • on* (Optional) Any UI element definition field that starts with on followed immediately by a capital letter and probably more letters is an event handler. Event handlers may be further divided into registered event handlers and DOM event handlers. Please refer to registerEvents and eventProcessors for more information.
    htmlList : Array

    List of HTML code to be added to the dialog's content area.

    [ nodeNameArg ] : Function | String

    A function returning a string, or a simple string for the node name for the root DOM node.

    Defaults to 'div'

    [ stylesArg ] : Function | Object

    A function returning an object, or a simple object for CSS styles applied to the DOM node.

    Defaults to {}

    [ attributesArg ] : Function | Object

    A fucntion returning an object, or a simple object for attributes applied to the DOM node.

    Defaults to {}

    [ contentsArg ] : Function | String

    A function returning a string, or a simple string for the HTML code inside the root DOM node. Default is empty string.

    Defaults to ''

    Returns

    uiElement
  • inherited

    accessKeyDown( dialog, key )

    The default handler for a UI element's access key down event, which tries to put focus to the UI element.

    Can be overridded in child classes for more sophisticaed behavior.

    Parameters

    dialog : dialog

    The parent dialog object.

    key : String

    The key combination pressed. Since access keys are defined to always include the CTRL key, its value should always include a 'CTRL+' prefix.

  • inherited

    accessKeyUp( dialog, key )

    The default handler for a UI element's access key up event, which does nothing.

    Can be overridded in child classes for more sophisticated behavior.

    Parameters

    dialog : dialog

    The parent dialog object.

    key : String

    The key combination pressed. Since access keys are defined to always include the CTRL key, its value should always include a 'CTRL+' prefix.

  • inherited

    disable()

    Disables a UI element.

  • inherited

    enable()

    Enables a UI element.

  • chainable inherited

    focus() → uiElement

    Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.

    uiElement.focus();
    

    Returns

    uiElement

    this

  • getAction() → String

    Gets the action assigned to the form.

    Returns

    String

    The value of the action.

  • inherited

    getDialog() → dialog

    Gets the parent dialog object containing this UI element.

    var dialog = uiElement.getDialog();
    

    Returns

    dialog

    Parent dialog object.

  • inherited

    getElement() → element

    Gets the root DOM element of this dialog UI object.

    uiElement.getElement().hide();
    

    Returns

    element

    Root DOM element of UI object.

  • inherited

    getInputElement() → element

    Gets the DOM element that the user inputs values.

    This function is used by setValue, getValue and focus. It should be overrided in child classes where the input element isn't the root element.

    var rawValue = textInput.getInputElement().$.value;
    

    Returns

    element

    The element where the user input values.

  • inherited

    getLabel() → String

    Retrieves the current label text of the elment.

    Returns

    String

    The current label text.

  • inherited

    getValue() → Object

    Gets the current value of this dialog UI object.

    var myValue = uiElement.getValue();
    

    Returns

    Object

    The current value.

  • inherited

    isChanged() → Boolean

    Tells whether the UI object's value has changed.

    if ( uiElement.isChanged() )
        confirm( 'Value changed! Continue?' );
    

    Returns

    Boolean

    true if changed, false if not changed.

  • inherited

    isEnabled() → Boolean

    Determines whether an UI element is enabled or not.

    Returns

    Boolean

    Whether the UI element is enabled.

  • inherited

    isFocusable() → Boolean

    Determines whether an UI element is focus-able or not. Focus-able is defined as being both visible and enabled.

    Returns

    Boolean

    Whether the UI element can be focused.

  • inherited

    isVisible() → Boolean

    Determines whether an UI element is visible or not.

    Returns

    Boolean

    Whether the UI element is visible.

  • chainable inherited

    registerEvents( definition ) → uiElement

    Registers the on* event handlers defined in the element definition.

    The default behavior of this function is:

    1. If the on* event is defined in the class's eventProcesors list, then the registration is delegated to the corresponding function in the eventProcessors list.
    2. If the on* event is not defined in the eventProcessors list, then register the event handler under the corresponding DOM event of the UI element's input DOM element (as defined by the return value of getInputElement).

    This function is only called at UI element instantiation, but can be overridded in child classes if they require more flexibility.

    Parameters

    definition : uiElement

    The UI element definition.

    Returns

    uiElement

    this

  • reset()

    Redraws the file input and resets the file path in the file input. The redrawing logic is necessary because non-IE browsers tend to clear the <iframe> containing the file input after closing the dialog window.

  • chainable inherited

    selectParentTab() → uiElement

    Selects the parent tab of this element. Usually called by focus() or overridden focus() methods.

    focus : function() {
        this.selectParentTab();
        // do something else.
    }
    

    Returns

    uiElement

    this

  • setInitValue()

    The default value of input type="file" is an empty string, but during the initialization of this UI element, the iframe still is not ready so it cannot be read from that object. Setting it manually prevents later issues with the current value ('') being different than the initial value (undefined as it asked for .value of a div).

  • chainable inherited

    setLabel( label ) → labeledElement

    Sets the label text of the element.

    Parameters

    label : String

    The new label text.

    Returns

    labeledElement

    The current labeled element.

  • chainable inherited

    setValue( value, noChangeEvent ) → uiElement

    Sets the value of this dialog UI object.

    uiElement.setValue( 'Dingo' );
    

    Parameters

    value : Object

    The new value.

    noChangeEvent : Boolean

    Internal commit, to supress change event on this element.

    Returns

    uiElement

    this

  • chainable

    submit() → file

    Uploads the file in the file input.

    Returns

    file

    This object.

Events

  • change( evt )

    Fired when the value of the uiElement is changed.

    Parameters

    evt : eventInfo