Skip to content

Functions and properties

Michel Chanton edited this page Apr 19, 2016 · 4 revisions

After initiating the editor object var editor = new wysihtml5.Editor("wysihtml-textarea"); there are various functions available on the obtained editor object.

.cleanUp(rules)

Parses and cleans the content of editor. Parameter rules is optional and if omitted uses rules provided at initiation. Custom rules parameter can be used for example for cleaning to plain text (using empty parser rules set):

editor.cleanup({tags: {}});

.config

Returns current editor configuration parameters

.disable()

Deactivate editor (make it readonly)

.enable()

Activate editor disable previously by .disable()

.focus()

Sets focus to editable area.

.getValue(parse)

It returns the cleaned HTML content of editor.

var html = editor.getValue();

Attribute parse can be set to false to get the uncleaned content from editor. Default is true.

.hasPlaceholderSet()

Returns if content empty placeholder is visible.

.isCompatible()

Returns if wysihtml is supported in current browser.

.setValue(html, parse)

Sets editor content to given html string. Attribute parse can be set to false to bypass HTML cleanup on insertion. Default is true.

Clone this wiki locally