This is a migrated thread and some comments may be shown as answers.

[Solved] Undo/Redo

2 Answers 110 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Travis
Top achievements
Rank 1
Travis asked on 14 Nov 2011, 08:30 PM
I know that I can do Ctl+Z and Ctl+Y for undo redo, but how do I make that a custom tool in the MVC editor?  I know this may sound crazy, but some users are just not smart enough to use Ctl+Z and Ctl+Y!  I tried calling the following script when the custom button is clicked, but nothing happens in the iframe:

document.execCommand('undo', false, null);

2 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 15 Nov 2011, 09:09 AM
Hi Travis,

You can execute the undo and redo command with the exec method of the editor, like this:

    $("#editor").data("tEditor").exec("undo"); // or exec("redo")

You can bind the above line as a custom command by following the custom tools example.

Greetings,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Travis
Top achievements
Rank 1
answered on 15 Nov 2011, 04:24 PM
Works great!  Thank you!!
Tags
Editor
Asked by
Travis
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Travis
Top achievements
Rank 1
Share this question
or