In order to reject specific changes during redaction process or to keep a full log of changes in the document, you need to pass a callback implementing IRedactionCallback into RedactorSettings. The interface contains only one method, acceptRedaction, which receives detailed information about the proposed redaction and returns a Boolean value — accepted or not.
Below, we create a callback with java.newProxy, dumping changes to the console:
constredaction=require('@groupdocs/groupdocs.redaction');constjava=require('java');constcallback=java.newProxy('com.groupdocs.redaction.redactions.IRedactionCallback',{acceptRedaction:function(description){letmessage=description.getRedactionType()+' redaction, '+description.getActionType()+' action, item '+description.getOriginalText()+'. ';if(description.getReplacement()!==null){message+='Text '+description.getReplacement().getOriginalText()+' is replaced with '+description.getReplacement().getReplacement()+'. ';}console.log(message);returntrue;}});
The instance of this callback is passed to a constructor of the Redactor class: