UNPKG

@syncfusion/ej2-documenteditor

Version:

Feature-rich document editor control with built-in support for context menu, options pane and dialogs.

240 lines (239 loc) 7.07 kB
import { RevisionType } from '../../base/types'; import { DocumentEditor } from '../../document-editor'; import { ElementBox, ParagraphWidget } from '../viewer/page'; import { WCharacterFormat } from '../format/character-format'; import { WRowFormat } from '../format/row-format'; import { TextPosition } from '../selection'; import { Dictionary } from '../../base/index'; import { ChangesSingleView } from '../track-changes/track-changes-pane'; /** * The revision class which holds the information related to changes made in the document */ export declare class Revision { /** * @private */ ownerNode: ParagraphWidget | WCharacterFormat | WRowFormat; /** * Gets or sets the author name who made the change */ author: string; /** * Indicates when the track changes made */ date: string; /** * Indicates the type of track changes revision */ revisionType: RevisionType; /** * To set the custom data value. */ customData: string; /** * Holds the reference of the items which are under this revision. * * @private */ private range; /** * @private */ revisionID: string; private owner; /** * Used to update cursor position by ensuring items were removed or not */ private isContentRemoved; private isTableRevision; /** * Indicates whether to skip unlinking ranges for table elements. */ private canSkipTableItems; private skipUnLinkElement; /** * Private */ hasChanges: boolean; constructor(documentHelper: DocumentEditor, author: string, date: string, ownerNode?: ParagraphWidget | WCharacterFormat | WRowFormat); /** * Retrieves the content of the revision as an HTML string. * * @returns {string} The revision content as HTML string. */ getContent(): string; /** * Updates the date of the revisions shown in the track changes pane. * @param {string} value - The date to be set for the revision. * @returns {void} * Note: Revision dates are system-generated to preserve the audit trail and is strongly discouraged to modify it. * Calling this API permanently overwrites the original timestamp and cannot be recovered from the document history. This can undermine audit and compliance requirements. * Only use in controlled scenarios (e.g., data migration with approvals). For additional or custom timestamps, use the 'customData' property instead. */ setDate(value: string): void; /** * @private */ getRange(updateRange?: boolean): (WCharacterFormat | WRowFormat | ElementBox)[]; /** * @private */ handleAcceptReject(isFromAccept: boolean, isGroupAcceptOrReject?: boolean): void; private handleGroupAcceptReject; private deleteTrackedContents; /** * Method which accepts the selected revision, revision marks will be removed and changes will be included in the viewer. * * @returns {void} */ accept(): void; /** * Method which rejects the selected revision, revision marks will be removed leaving the original content. */ reject(): void; /** * Select the current revision. */ select(): void; /** * Unlinks revision and its assosiated range * @private * @param item * @param revision * @param isFromAccept */ unlinkRangeItem(item: any, revision: Revision, isFromAccept: boolean, start: TextPosition, end: TextPosition): boolean; private removeRevisionFromPara; private updateRevisionID; private removeAllRevisionsFromItem; /** * Method to remove current revision from the item * * @private * @param {any} item - Specifies the item * @returns {void} */ removeCurrentRevisionFromItem(item: any, skipUpdate?: boolean): void; /** * @private * @param {Element} element - Specifies the element. * @returns {boolean} Resturs skip element removal */ skipeElementRemoval(element: ElementBox): boolean; private removeItem; private canSkipCloning; /** * @private * */ destroy(): void; /** * @private * @returns {Revision} - Returns revision */ clone(): Revision; /** * @private */ cloneRevision(): Revision; /** * Method to clone the revisions for the element * * @param {Revision[]} revisions - revision array. * @returns {string[]} - returns clones revisions. */ static cloneRevisions(revisions: Revision[]): string[]; } /** * Represents the revision collections in the document. */ export declare class RevisionCollection { /** * @private */ groupedView: Dictionary<ChangesSingleView, Revision[]>; /** * @private */ revisions: Revision[]; /** * @private */ changes: Revision[]; /** * @private */ isAcceptAllOrRejectAll: boolean; private owner; /** * @private */ get(index: number): Revision; readonly length: number; constructor(owner: DocumentEditor); /** * @private */ checkAndGetPreviousRevisionToCombine(revision: Revision): Revision; /** * @private */ checkAndGetNextRevisionToCombine(revision: Revision): Revision; /** * @private */ addRevision(revision: Revision): void; /** * @private */ insertRevisionAt(index: number, revision: Revision): void; private getIndexToInsertInGroup; private combineWithExistingRevision; private clearChildren; private getNextRevision; private insertNewRevision; /** * @private */ splitView(previousRevision: Revision, previousSingleView: ChangesSingleView, currentChangeView: ChangesSingleView, threadIndex: number): void; private createSplittedView; /** * @private */ getChildIndexQuery(childElement: HTMLElement): number; /** * @private */ isSameRevisionType(previousRevision: Revision[], currentRevision: Revision, commonRevision: Revision[], skipAuthorCheck: boolean): boolean; remove(revision: Revision): any; private checkAndCombineWithNextRevision; /** * @private */ combineWithNextRevision(currentRevision: Revision, nextRevision: Revision): void; /** * Method which accepts all the revision in the revision collection * * @returns {void} */ acceptAll(): void; /** * Method which rejects all the revision in the revision collection * * @returns {void} */ rejectAll(): void; /** * @private * @param {boolean} isfromAcceptAll - Specifies the is accept all. * @param {Revision[]} changes - Specifies the revisions. * @returns {void} */ handleRevisionCollection(isfromAcceptAll: boolean, changes?: Revision[]): void; clear(): void; /** * Disposes the internal objects which are maintained. * @private */ destroy(): void; }