New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

RadEditor Object

The RadEditor object exposes the following public methods and properties to control its behavior:

RadEditor Client-Side Methods

NameParametersReturn TypeDescription
addCustomWordStringAdds a custom word to the collection.The method takes the following arguments: word - The custom word to be added.
addShortCutString, StringAdds shortcut to the RadEditor's ShortCutManagerThe method takes the following arguments: shortcutName - Name of the shortcut shortcutString - The key combination of the shortcut
attachEventHandlerString, FunctionAttaches an event to RadEditorThe method takes the following arguments: eventName - The name of the event to be handled fnRef - The function to be registered to the event
createElementString, String, String, String, String, StringElementCreates DOM element and return reference to itThe method takes the following arguments: tagName - Element styleWidth - Width of the element styleHeight - Height of the element sId - ID of the element sName - Name of the element sValue - Value of the element
createRestorePointYou can store and restore the exact position of the cursor using createRestorePoint and select method. Use getSelection().getRange()instead of the obsolete createRestorePoint()
detachEventHandlerString, FunctionDetaches an event handler.The method takes the following arguments: eventName - The name of the event to be handled fnRef - The function to be removed from the eventListenerList
disableContentAreaStylesheetBooleanToggles the state if the content area's CSS file.The method takes the following arguments: toEnable? - Indicates whether to disable or enable the style sheet (NOTE: If argument is not available, the state will be switched).
displayMaxHtmlLengthErrorMessageShows the alert to inform the user about reaching the limit of the MaxHtmlLength.
displayMaxTextLengthErrorMessageShows the alert to inform the user about reaching the limit of the MaxTextLength.
enableEditingBoolean, Telerik.Web.UI.EditingOptions, ArrayAbility to programmatically disable/enable editing in editor while retaining its looksThe method takes the following arguments: enable - Specifies whether enable or disable editing editingOptions - Which editing options to enable optionalIgnoredTools - Array of tool names to enable
executeCommandString, Boolean, BooleanExecutes a RadEditor command.The method takes the following arguments: radCommand - The command name. setFocus - Specifies whether to focus the content area or not. addToStack - Specifies whether to add the command in the undo/redo stack.
getDomRangeTelerik.Web.UI.Editor.DomRangeGets a reference to a DomRange object that represents the current selection in the RadEditor.
fireString, ObjectExecutes a built-in command.The method takes the following arguments: comamndName - The name of the tool. args - Command arguments. You can pass either an object of type Telerik.Web.UI.EditorCommandEventArgs or one with a value field - { value: String }.
get_ajaxSpellCheckTelerik.Web.UI.Editor.AjaxSpellCheckReturns the instance of the AjaxSpellCheck.
get_commandsManagerTelerik.Web.UI.Editor.CommandsManagerReturns the CommandsManager instance used by the RadEditor.
get_contentAreaObjectReturns a reference to the RadEditor's content area's body element
get_contentAreaElementElementReturns a reference to the RadEditor's content area element.
get_dialogOpenerTelerik.Web.UI.RadDialogOpenerReturns teh instance to the RadDialogOpener.
get_documentObjectReturns a reference to the RadEditor's content area's document object
get_editableBooleanReturns whether the RadEditor's content area is editable or not
get_enableImmutableElementsBooleanReturns a Boolean value that indicates whether immutability is enabled or not.
get_filtersManagerTelerik.Web.UI.Editor.FiltersManagerReturns a reference to RadEditor's filters manager
get_htmlBoolean, Telerik.Web.UI.EditorStripHtmlOptionsStringReturns the editor content as HTMLThe method takes the following arguments: isFiltered? - Indicates whether the content to be returned after processing it with the content filters or not. removeComments? - Indicates whether the content to be returned without inserted comments.
get_languageStringReturns current language
get_localizationObjectReturns an associative array of RadEditor's localization
get_mainTableElementReturn a reference to the RadEditor's wrapping DOM element
get_modeTelerik.Web.UI.EditModesReturns the editor'sEditMode
get_modulesManagerTelerik.Web.UI.Editor.ModulesManagerGets a reference to the modules manager.
get_qualifiedSkinStringReturns the qualified name of the skin.
get_shortCutManagerTelerik.Web.UI.EditorShortCutManagerReturns a reference to the ShortCutManager instance.
get_spellCheckServiceTelerik.Web.UI.SpellCheckServiceReturns a reference to the used SpellCheckService
get_textObjectStringReturns the editor content as plain text (strips down the tags).As of Q1 2015 , optionally,you can configure how the text to be stripped via the options parameter. options - Options for the strip behavior. Example:{ trimText: true, removeMultipleSpaces: true }. trimText - Removes all leading and trailing white-space characters; removeMultipleSpaces - Merges all white-space characters.
get_textAreaElementReturns a reference to the RadEditor's TextArea in Html mode
get_toolAdapterTelerik.Web.UI.Editor.DefaultToolAdapterGets a reference to the tool adapter.
get_toolContainerElementReturns a reference to the Toolbar container DOM element
get_toolHTMLStringReturns the inner HTML of the ToolContainer as string.
get_TopZoneElementReturns the wrapper element of the toolbar.
get_useClassicDialogsBooleanReturns whether RadEditor is using RadWindow windows or browser popup windows for its dialogs.
getContextMenuByTagNameStringTelerik.Web.UI.EditorContextMenuReturns a reference to the context menu objectThe method takes the following arguments: tagName - The Tag name of the context menu
getCssArrayArrayReturns a collection of class names existing in the CSS files added to the Iframe's content area.
getEditorSelectionRangeObjectReturns the current selection range.
getHeaderToolByNameStringTelerik.Web.UI.EditorButtonReturns a reference to a specified header tool. The method takes the following arguments: toolName - The name of the tool
getSelectedElementElementReturns a reference to the currently selected HTML element in the editor's content area
getSelectionTelerik.Web.UI.Editor.SelectionReturns a reference to the current RadEditorSelection object
getSelectionHtmlStringReturns the selected HTML.
getToolByNameStringTelerik.Web.UI.EditorButtonReturns a reference to a specified tool. The method takes the following arguments: toolName - The name of the tool
getToolStateString, ObjectTelerik.Web.UI.EditingOptionsReturns current state of a toolThe method takes the following arguments: toolName - The name of the tool range - The selection range.
getToolValueString, ObjectStringReturns current value of a tool.The method takes the following arguments: toolName - The name of the tool. range - The selection range.
isFullScreenBooleanIndicates whether the RadEditor is in full screen mode.
isVisibleReturns Boolean value that represents if the Editor is visible on the page
onParentNodeChangedRe-creates the iframe content area of the RadEditor.
pasteHtmlString, String, Boolean, Boolean, BooleanPastes HTML content to the cursor position.The method takes the following arguments: content - The content to be pasted commandName? - The name of the command using PasteHtml for Undo bSelectText? - Specifies whether to select pasted text bFireSelChanged? - Specifies whether to fire the selection change event bAddUndo? - specifies whether to add the command in the Undo
pasteHyperLinkElement, StringInserts a link element in the editor content.The method takes the following arguments: linkElmenet - The DOM element of the link. commandName - The command name fired the method.
raiseEventString, ObjectRaise a RadEditor's eventThe method takes the following arguments: evName - Name of the event to be raised args - Arguments to be sent
redoNumberFire RadEditor's Redo commandThe method takes the following arguments: depth - Number of commands to redo
removeNodeImmutabilityElementModifies a node from the content to be editable.The method takes the following arguments: node - The node element.
removeShortCutStringRemoves a shortcut from the RadEditor's ShortCutManagerThe method takes the following arguments: shortcutName - Name of the the shortcut
repaintRe-renders the editor on the client. Useful when the editor is in an invisible container that is shown dynamically.
saveContentForce RadEditor to save current content
selectElementElement, BooleanSelect an element from the content areaThe method takes the following arguments: element - Element to be selected fireEvent? - Specifies whether to raise the selectionChange event
set_ajaxSpellCheckTelerik.Web.UI.Editor.AjaxSpellCheckSets the AjaxSpellCheck instance to be used by the RadEditor.The method takes the following arguments: ajaxSpellCheck - The instance of the AjaxSpellCheck to serve the spell checking service.
set_editableBooleanSets mode of the RadEditor's content areaThe method takes the following arguments: editable - Specifies whether to enable or disable edit-ability.
set_enableImmutableElementsBooleanSets a Boolean value that indicates whether immutability to be enabled or not.The method takes the following arguments: value - Indicates whether to be enabled or disabled.
set_htmlString, String, Boolean, BooleanReplaces the current content with a new one.The method takes the following arguments: content - The HTML content to be inserted. title? - The command's title shown in the Undo stack. setFocus? - Specifies whether setFocus to be fired after the command execution raiseSelChanged? - Indicates whether to raise selectioChange event.
set_modeTelerik.Web.UI.EditModesSets RadEditor in HTML, Preview or Design modeThe method takes the following arguments: value - The mode to be switched on.
set_useClassicDialogsBooleanSpecifies whether RadEditor will use RadWindow instances or browser's windows to open dialogs. If the parameter is set to true the editor will use the browser windows.The method takes the following arguments: value - Indicates whether to enable or disable.
set_visibleBooleanSets the RadEditor visible on the clientThe method takes the following arguments: toShow - Indicates whether to be visible or not.
setActiveIE ONLY. Alias of setFocus
setFocusSets the focus on RadEditor
setNodeImmutabilityElementModifies a node from the content to be not editable.The method takes the following arguments: node - some description
setShortCutString, StringSets a shortcut. If it does not exist in the ShortCutManager list it will be added as wellThe method takes the following arguments: shortcutName - Name of the shortcut shortcutString - The key combination of the shortcut
setSizeNumber, NumberSets the width and height of the RadEditor (in pixels)The method takes the following arguments: width - Width to be set height - Height to be set
showDialogString, Object, FunctionOpen a light dialog.The method takes the following arguments: dialogName - The name of the dialog to be opened. argument - The client parameters to be passed to the dialog callbackFunction - The function to be executed when the dialog is closed. The function syntax is myFunction
showExternalDialogString, Object, Number, Number, Function, Object, String, String, Telerik.Web.UI.WindowBehaviors, Boolean, BooleanOpen a dialog, placed in an external page.The method takes the following arguments: url - The URL of the ASPX page to open. argument - The client parameters to be passed to the dialog. Optional. width - The width of the RadWindow dialog. Required. height - The height of the RadWindow dialog. Required. callbackFunction - The function to be executed when the dialog is closed. The function syntax is myFunction callbackArgs - The additional parameters to be passed to the callbackFunction when it is executed. Optional. title - The text in the RadWindow title bar. Optional. modal - Specifies whether RadWindow should be modal or not. The default is true. Optional. behaviors - The WindowBehaviors to be enabled for the dialog. showStatusbar - Specifies whether RadWindow displays its statusbar or not. The default is true. Optional. showTitlebar - Specifies whether RadWindow displays its titlebar or not. The default is true. Optional.
startSpellCheckCauses the editor to start the spell checker.
toggleScreenModeToggles the full screen mode of RadEditor.
undoNumberFire RadEditor's Undo commandThe method takes the following arguments: depth - Number of commands to undo
usesContentFilterStringBooleanReturns a Boolean value indicating whether the passed filter is enabled or not.The method takes the following arguments: filterName - The name of the tool.
validateMaxHtmlLengthStringBooleanValidates the current length of the HTML content. Optional String parameter can be added to validate with additional content without inserting it into the HTML.The method takes the following arguments: html? - Additional HTML to validate with.
validateMaxTextLengthStringBooleanValidates the current length of the text. Optional String parameter can be added to validate with additional text without inserting it into the content.The method takes the following arguments: text? - Additional text to validate with.

RadEditor Client-Side Methods for attaching/detaching client-side event handlers

NameArgumentsDescription
add_commandExecutedFunctionAdds a handler for the commandExecuted RadEditor client event.
add_commandExecutingFunctionAdds a handler for the commandExecuting RadEditor client event.
add_domChangeFunctionAdds a handler for the domChange RadEditor client event.
add_editReadyFunctionAdds a handler for the editReady RadEditor client event.
add_firstShowFunctionAdds a handler for the firstShow RadEditor client event.
add_initFunctionAdds a handler for the init RadEditor client event.
add_inlineEditCompletedFunctionAdds a handler for the inlineEditCompleted RadEditor client event.
add_loadFunctionAdds a handler for the load RadEditor client event.
add_modeChangeFunctionAdds a handler for the modeChange RadEditor client event.
add_pasteHtmlFunctionAdds a handler for the pasteHtml RadEditor client event.
add_selectionChangeFunctionAdds a handler for the selectionChange RadEditor client event.
add_spellCheckLoadedFunctionAdds a handler for the spellCheckLoaded RadEditor client event.
add_submitFunctionAdds a handler for the submit RadEditor client event.
add_toggleScreenModeFunctionAdds a handler for the toggleScreenMode RadEditor client event.
remove_commandExecutedFunctionRemoves a handler for the commandExecuted RadEditor client event.
remove_commandExecutingFunctionRemoves a handler for the commandExecuting RadEditor client event.
remove_domChangeFunctionRemoves a handler for the domChange RadEditor client event.
remove_editReadyFunctionRemoves a handler for the editReady RadEditor client event.
remove_firstShowFunctionRemoves a handler for the firstShow RadEditor client event.
remove_initFunctionRemoves a handler for the init RadEditor client event.
remove_inlineEditCompletedFunctionRemoves a handler for the inlineEditCompleted RadEditor client event.
remove_loadFunctionRemoves a handler for the load RadEditor client event.
remove_modeChangeFunctionRemoves a handler for the modeChange RadEditor client event.
remove_pasteHtmlFunctionRemoves a handler for the pasteHtml RadEditor client event.
remove_selectionChangeFunctionRemoves a handler for the selectionChange RadEditor client event.
remove_spellCheckLoadedFunctionRemoves a handler for the spellCheckLoaded RadEditor client event.
remove_submitFunctionRemoves a handler for the submit RadEditor client event.
remove_toggleScreenModeFunctionRemoves a handler for the toggleScreenMode RadEditor client event.
Not finding the help you need?
Contact Support