Clear history

Is there a method to clear the undo/redo history in the RichTextEditor?
I want to clear it when changing document.

Thanks

3 Replies 1 reply marked as answer

RK Revanth Krishnan Syncfusion Team January 20, 2021 06:45 AM UTC

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 


Marked as answer

RC Richard Craig January 20, 2021 10:24 AM UTC

Thanks.
I tried refreshUI but didn't think to try just refresh :)


RK Revanth Krishnan Syncfusion Team January 21, 2021 07:40 AM UTC

Hi Richard, 
 
We are glad that the reported issue has been resolved. 
 
Please let us know if you need any further assistance. 
 
Regards, 
Revanth 


Loader.
Up arrow icon