new TrackedChangeManager()
Manages tracked changes within an Office Editor document.
Example
const trackedChangeManager = instance.Core.documentViewer.getDocument().getOfficeEditor().getTrackedChangeManager();
Members
-
<static> TrackedChangeColorPreset
-
Preset values for tracked change colors.
Properties:
Name Type Description NONEstring Use no markup color. AUTOstring Use the author color (auto). -
<static> TrackedChangeType
-
An enum representing the tracked change types in Office Editor.
Properties:
Name Type Description INSERTEDstring inserted tracked changes DELETEDstring deleted tracked changes FORMATTEDstring formatted tracked changes
Methods
-
acceptTrackedChange(id)
-
Accepts a tracked change in the document.
Parameters:
Name Type Description idnumber The numeric id of the tracked change to accept. Returns:
- Type
- Promise.<void>
Example
const trackedChangeManager = instance.Core.documentViewer.getDocument().getOfficeEditor().getTrackedChangeManager(); await trackedChangeManager.acceptTrackedChange(3);
-
getTrackedChangeOOXMLIds()
-
Returns the mapping of tracked change IDs to OOXML tracked change IDs. OOXML is the Office Open XML representation used by Office documents. These IDs can be used to connect imported OOXML tracked changes to WebViewer tracked change IDs. OOXML IDs come from the source document and are not available for tracked changes created within WebViewer.
This is an experimental API intended for advanced users and may change in future releases.Returns:
Map of tracked change ids to OOXML tracked change ids.- Type
- Promise.<Map.<number, Array.<number>>>
Examples
// Lookup OOXML IDs for a specific tracked change. const trackedChangeManager = instance.Core.documentViewer.getDocument().getOfficeEditor().getTrackedChangeManager(); const ooxmlIdsMap = await trackedChangeManager.getTrackedChangeOOXMLIds(); const trackedChangeId = 3; const ooxmlIds = ooxmlIdsMap.get(trackedChangeId) || [];
// Build a reverse lookup from OOXML ID to tracked change ID. const trackedChangeManager = instance.Core.documentViewer.getDocument().getOfficeEditor().getTrackedChangeManager(); const ooxmlIdsMap = await trackedChangeManager.getTrackedChangeOOXMLIds(); const ooxmlIdToTrackedChange = new Map(); for (const [trackedChangeId, ooxmlIds] of ooxmlIdsMap.entries()) { for (const ooxmlId of ooxmlIds) { ooxmlIdToTrackedChange.set(ooxmlId, trackedChangeId); } } const trackedChangeId = ooxmlIdToTrackedChange.get(42); -
getTrackedChanges()
-
Returns an array of tracked change objects.
Returns:
The tracked changes in the documentExample
const trackedChangeManager = instance.Core.documentViewer.getDocument().getOfficeEditor().getTrackedChangeManager(); const trackedChanges = trackedChangeManager.getTrackedChanges(); instance.Core.documentViewer.getDocument().addEventListener('trackedChangesUpdated', () => { const updatedChanges = trackedChangeManager.getTrackedChanges(); }); -
moveCursorToTrackedChange(id)
-
Moves the main cursor to the start of the tracked change with the given id.
Parameters:
Name Type Description idnumber The id of the tracked change to move to. Returns:
- Type
- Promise.<void>
Example
const trackedChangeManager = instance.Core.documentViewer.getDocument().getOfficeEditor().getTrackedChangeManager(); await trackedChangeManager.moveCursorToTrackedChange(3);
-
rejectTrackedChange(id)
-
Rejects a tracked change in the document.
Parameters:
Name Type Description idnumber The numeric id of the tracked change to reject. Returns:
- Type
- Promise.<void>
Example
const trackedChangeManager = instance.Core.documentViewer.getDocument().getOfficeEditor().getTrackedChangeManager(); await trackedChangeManager.rejectTrackedChange(3);
Type Definitions
-
TrackedChange
-
Represents a tracked change in an Office Editor document.
Type:
- Object
Properties:
Name Type Description idnumber The id of the tracked change typeCore.Document.OfficeEditor.TrackedChangeManager.TrackedChangeType The type of the tracked change authorstring The author of the tracked change dateDate The date of the tracked change plaintextstring The content of the tracked change to be inserted or deleted getPagePositionsfunction Returns a promise that resolves to an array of objects containing {pageNumber: number, rect: Core.Math.Rect} for each annotation related to the tracked change. -
TrackedChangeColor
-
Type: