Hi Richard,
Greetings from Syncfusion support.
We have validated your query “Need a method to clear the undo-redo history in the Rich Text Editor when changing the document”.
The undo-redo history can be cleared by using the ‘refresh’ public method in the Rich Text Editor. We have prepared a sample for your reference,
Code Snippet:
|
constructor() {
super(...arguments);
this.clearUndoRedo = () => {
this.rteObj.value = "";
this.rteObj.refresh();
};
}
render() {
return (
<div>
<RichTextEditorComponent
ref={richtexteditor => {
this.rteObj = richtexteditor;
}}
>
<Inject services={[HtmlEditor, Toolbar, Image, Link, QuickToolbar]} />
</RichTextEditorComponent>
<ButtonComponent
id="selectHtml"
ref={btn => {
this.selectHtml = btn;
}}
onClick={this.clearUndoRedo.bind(this)}
className="btn btn-default"
>
Clear Undo Redo
</ButtonComponent>
</div>
);
} |
Please check the above code snippet and the sample and let us know if it satisfies your requirement.
Regards,
Revanth