Skip to content

Undo and Redo

Content editing supports Undo and Redo, allowing users to easily revert or restore actions during editing.

Toolbar Actions

Users can directly tap the Undo/Redo buttons on the bottom toolbar.

API Calls

Developers can use the historyManager to implement custom undo/redo logic.

Set Callbacks

tsx
const manager = pdfReaderRef.current._editManager;
const historyManager = manager.historyManager;

// Set a callback to monitor history state changes
historyManager.setOnHistoryStateChangedListener((pageIndex, canUndo, canRedo) => {
});

// Undo
if (await historyManager.canUndo()) {
  await historyManager.undo();
}

// Redo
if (await historyManager.canRedo()) {
  await historyManager.redo();
}