armor-editor
Version:
Advanced rich text editor with premium armor-grade security, real-time collaboration, spell checking, track changes, and framework-agnostic design for React, Vue, Angular, Next.js, Nuxt.js
46 lines (45 loc) • 1.39 kB
TypeScript
export interface DocumentVersion {
id: string;
version: string;
content: string;
author: {
id: string;
name: string;
email: string;
};
timestamp: Date;
message: string;
changes: ChangeSet[];
parentVersion?: string;
tags?: string[];
}
export interface ChangeSet {
type: 'insert' | 'delete' | 'modify';
position: number;
length: number;
oldContent?: string;
newContent?: string;
}
export declare class VersionSystem {
private versions;
private currentVersion;
private editor;
private autoSaveEnabled;
constructor(editor: any);
private setupAutoVersioning;
createVersion(message: string, author: any): DocumentVersion;
private createAutoVersion;
restoreVersion(versionId: string): boolean;
compareVersions(versionId1: string, versionId2: string): ChangeSet[];
getVersionHistory(): DocumentVersion[];
getCurrentVersion(): DocumentVersion | null;
tagVersion(versionId: string, tag: string): boolean;
branchFromVersion(versionId: string, branchName: string): string;
private diffContent;
private calculateChanges;
private generateVersionId;
private generateVersionNumber;
exportVersionHistory(): string;
importVersionHistory(historyJson: string): boolean;
showVersionComparison(versionId1: string, versionId2: string): void;
}