RadEditor for ASP.NET

CreateRestorePoint Send comments on this topic.
Client-side API Reference > Methods > CreateRestorePoint

Glossary Item Box

You can store and restore the exact position of the cursor using CreateRestorePoint and Select methods. These methods are useful in scenarios when you want to paste content in the editor from a custom dialog or another location.

var restorePoint = editor.CreateRestorePoint(); //returns an object that represents a restore point.

restorePoint.Select(); //Selects the restore point in case you need to restore the cursor to its original location.

Here is an example on how to use both method in a custom dialog scenario:

JavaScript Copy Code
<script type="text/javascript">
var RadEditor1ClientObject = null;
RadEditorCommandList[
"CustomDialog"] = function CustomDialogCommand(commandName, editor, oTool)
{
   
var restorePoint = editor.CreateRestorePoint(); //returns an object that represents a restore point.
   
RadEditor1ClientObject = editor;
   editor.ShowDialog(
      
"MyCustomDialog.html"
       
, null //argument
       
, 180
       , 80
       , CustomDialogCallback
       , null
       ,
"Custom Dialog");
}
;
function CustomDialogCallback(returnValue)
{
   
restorePoint.Select(); //Selects the restore point in case you need to restore the cursor to its original location.
   
if (returnValue)
   {
       
RadEditor1ClientObject.PasteHtml("<a href=\"" + returnValue.url + "\">" + returnValue.text + "</a>");
   }
}
</script>