Module

ui/bindings/preventdefault

@ckeditor/ckeditor5-ui/src/bindings/preventdefault

module

Filtering

Functions

  • preventDefault( view ) → ListenerBinding

    A helper which executes a native Event.preventDefault() if the target of an event equals the element of the view. It shortens the definition of a template.

    // In a class extending View.
    import preventDefault from '@ckeditor/ckeditor5-ui/src/bindings/preventdefault';
    
    // ...
    
    this.setTemplate( {
    	tag: 'div',
    
    	on: {
    		// Prevent the default mousedown action on this view.
    		mousedown: preventDefault( this )
    	}
    } );
    

    Parameters

    view : View<HTMLElement>

    View instance that defines the template.

    Returns

    ListenerBinding