mariappan k
mariappan k

Reputation: 199

Is there any way to reset undo in ckeditor after setData?

I want reset the undo functionality after set Data method in ckeditor.

any one know please let me know.

editor.setData(content,function(){
    this.checkDirty();
});

Upvotes: 1

Views: 1030

Answers (3)

S K R
S K R

Reputation: 592

With CK Editor 5:

To reset undo/redo state, use:

editor.setData(newData);
// OR
editor.data.set(newData);

To keep undo/redo state, use:

editor.data.set(newData, {batchType: {isUndoable: true}});

Upvotes: 0

ali.alfoly
ali.alfoly

Reputation: 26

After the trouble of searching the clock All roads do not work I do not know the reason

reset

resetDirty

resetUndo

The solution is

CKEDITOR.instances.editor1.setData('Text_Html',function() { this.resetUndo(); });

Upvotes: 1

Wizard
Wizard

Reputation: 3151

Use resetDirty()

Resets the "dirty state" of the editor so subsequent calls to checkDirty will return false if the user will not have made further changes to the content.

alert( editor.checkDirty() ); // e.g. true

editor.resetDirty();

alert(editor.checkDirty() ); // false

Upvotes: 0

Related Questions