Skip to content

Instantly share code, notes, and snippets.

@smailliwcs
Created September 22, 2020 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smailliwcs/c9a8651076d59c9f2cad68c3e6edee8e to your computer and use it in GitHub Desktop.
Save smailliwcs/c9a8651076d59c9f2cad68c3e6edee8e to your computer and use it in GitHub Desktop.
TinyMCE plugin: revert
tinymce.PluginManager.add("revert", function (editor) {
var content;
editor.on("LoadContent", function () {
content = editor.getContent();
});
editor.addMenuItem("revert", {
text: "Revert changes",
context: "file",
onclick: function () {
editor.undoManager.transact(function () {
editor.setContent(content);
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment