TinyMCE:API/tinymce.Editor/selection

From Moxiecode Documentation Wiki

Jump to: navigation, search

Property: selection

Summary

This property contains an instance of the tinymce.dom.Selection class. It enables you to check what elements and contents the user has selected inside the editor it also enables you to insert contents where the cursor is located and much more.

Examples

// Sets some contents to the current selection in the editor
tinyMCE.activeEditor.selection.setContent('Some contents');

// Gets the current selection
alert(tinyMCE.activeEditor.selection.getContent());

// Selects the first paragraph found
tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.dom.select('p')[0]);
Personal tools