Sign up (with export icon)

ui/bindings/preventdefault

Api-module iconmodule

Functions

  • Chevron-right icon

    preventDefault( view ) → ListenerBinding
    internal

    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 )
    	}
    } );
    
    Copy code

    Parameters

    view : View

    View instance that defines the template.

    Returns

    ListenerBinding