6

I have one editor where I switch between content in one editor, and what I want to do when I set the new content, I would like to reset the undo possibility.

I have read on this site http://www.tinymce.com/wiki.php/api4:class.tinymce.UndoManager

That it's just to call tinymce.UndoManager.clear() but I just get that the function is undefined.

2
  • 1
    On the WP default TinyMCE editor is the undo button include, inside the line 2 of the TinyMCE editor. You see this second line only, after click on "Toolbar Toggle" button, the last button on TinyMCE line 1.
    – bueltge
    Commented Jul 15, 2015 at 9:42
  • @Fredrik Could you post the code you're working with so we can use that as a starting point to help you? Particularly, where you're running the clear() function
    – Tim Malone
    Commented Jun 29, 2016 at 8:02

1 Answer 1

1

The global variable tinyMCE has an array of editors. So you have to call the undoManager inside them. Like this for default wp editor on post edit/create screen:

tinyMCE.editors[0].undoManager.clear();

If you want to do it in a specific editor, select the editor id in n like this:

var n = 0; // editor id
tinyMCE.editors[n].undoManager.clear();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.