Documentation

Component

setActive

Arguments
el Node Element Dom

Set the active class to the component.

this.component.setActive(element);

isActive

Arguments
el (optional) Node Element Dom

Returns: Boolean

Check if the Redactor content has the active component or if the specified element is the active component.

// content has active component
var is = this.component.isActive();

 // element is active component
var is = this.component.isActive(element);

getActive

Returns: Node Boolean

Return the active component in the Redactor content. If the active component is not exist returns false.

var component = this.component.getActive();

clearActive

Clear the active class from all component in Redactor.

this.component.clearActive();

create

Arguments
type String

Returns: Object Boolean

Create and return the component object by the type.

var component = this.component.create('image');

build

Arguments
el Node Element Dom

Returns: Object Node

Build and return the element's component object if el has a data-redactor-type attribute, if hasn't return el.

var component = this.component.build(element);

remove

Arguments
el Node Element Dom

Remove component and set the caret after the removed component.

this.component.remove(element);