The Annotation History Manger keeps track of changes the user has recently made to any annotations. It contains APIs to undo and redo these changes.
To get a reference to the history manager, use the docViewer.getAnnotationHistoryManager() API. From there, you can can call functions such as undo()
and redo()
.
For example, to make your own custom button that undoes the last change to an annotation, you could do something like this:
WebViewer({...}, ele)
.then(instance => {
const { docViewer } = instance;
docViewer.on('annotationsLoaded', () => {
const historyManager = docViewer.getAnnotationHistoryManager();
document.getElementById('undo-button').onclick = () => {
if(historyManager.canUndo()) {
historyManager.undo();
}
}
})
})
WebViewer({...}, ele)
.then(instance => {
const { documentViewer } = instance.Core;
documentViewer.addEventListener('annotationsLoaded', () => {
const historyManager = documentViewer.getAnnotationHistoryManager();
document.getElementById('undo-button').onclick = () => {
if(historyManager.canUndo()) {
historyManager.undo();
}
}
})
})