Documentation

Editor

isEmpty #

Returns: Boolean

Check if the editor layer is empty.

var is = this.editor.isEmpty();

The method checks as follows: if HTML contains nothing but spaces, empty tags and br tags, then the editor layer is empty.

focus #

Set the focus to the editor layer if the focus has not been set.

this.editor.focus();

startFocus #

Set the focus to the editor layer to the beginning of the content.

this.editor.startFocus();

endFocus #

Set the focus to the editor layer to the end of the content.

this.editor.endFocus();

isFocus #

Returns: Boolean

Check if the focus is in the editor layer.

this.editor.endFocus();

isSourceMode #

Returns: Boolean

Check if Redactor in the source mode.

var is = this.editor.isSourceMode();

saveScroll #

Save the scrollbar position in the document to the temporary variable, for later restore using the editor.restoreScroll() method.

this.editor.saveScroll();

restoreScroll #

Restore the scrollTop position of the scrollbar in the document if it was previously saved using the editor.saveScroll() method.

this.editor.restoreScroll();

getFirstNode #

Returns: Node

Return the first node of the editor content.

var node = this.editor.getFirstNode();

getLastNode #

Returns: Node

Return the last node of the editor content.

var node = this.editor.getLastNode();

getElement #

Returns: Object

Return the wrapped Dom object of Redactor's editable layer.

var $editor = this.editor.getElement();

The editor element is the editable layer of Redactor.