Search code examples
javascriptckeditor

CKEditor restore element / undo all changes


Is there a way to restore the original content / undo all changes of an element that had become an Inline-CKEditor?


Solution

  • My solution:

    After instantiating CKEditor I save the initial content with CKEDITOR.editor1.getData() to a custom variable CKEDITOR.editor1.firstSnapshot. Later when I want to restore it I write it back with CKEDITOR.editor1.setData(CKEDITOR.editor1.firstSnapshot);

    At first I wanted to use getSnapshot() but however it always returned true, so that didn't work for me.