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
383 lines (382 loc) • 12.1 kB
TypeScript
export declare const VERSION = "2.0.15";
import { Theme } from './themes';
import { Plugin } from './plugins';
export interface EditorOptions {
container: HTMLElement | string;
placeholder?: string;
toolbar?: boolean | string[];
height?: string;
width?: string;
theme?: string | Theme;
language?: string;
plugins?: string[];
onChange?: (content: string) => void;
onReady?: () => void;
uploadUrl?: string;
collaboration?: {
channelId: string;
userId: string;
userName: string;
};
trackChanges?: boolean;
comments?: boolean;
spellCheck?: boolean;
spellCheckOptions?: {
language?: string;
apiKey?: string;
customDictionary?: string[];
};
wordCount?: boolean;
autoSave?: {
interval: number;
callback: (content: string) => void;
};
export?: {
pdf?: boolean;
word?: boolean;
};
mathType?: boolean;
mediaEmbed?: boolean;
mentions?: {
feeds: Array<{
name: string;
id: string;
}>;
};
customFonts?: string[];
shortcuts?: boolean;
performance?: {
monitoring?: boolean;
virtualScrolling?: boolean;
lazyLoading?: boolean;
chunkSize?: number;
};
readOnly?: boolean;
mobile?: {
enabled?: boolean;
collapsibleToolbar?: boolean;
touchGestures?: boolean;
};
ai?: {
enabled?: boolean;
provider?: 'openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface';
apiKey?: string;
model?: string;
features?: string[];
providers?: {
openai?: {
apiKey: string;
models: string[];
defaultModel?: string;
};
anthropic?: {
apiKey: string;
models: string[];
defaultModel?: string;
};
google?: {
apiKey: string;
models: string[];
defaultModel?: string;
};
cohere?: {
apiKey: string;
models: string[];
defaultModel?: string;
};
huggingface?: {
apiKey: string;
models: string[];
defaultModel?: string;
};
};
};
analytics?: {
enabled?: boolean;
trackEvents?: string[];
};
encryption?: {
enabled?: boolean;
endToEnd?: boolean;
};
sso?: {
provider?: 'saml' | 'oauth2' | 'oidc';
entityId?: string;
ssoUrl?: string;
certificate?: string;
};
compliance?: {
gdpr?: {
enabled?: boolean;
dataRetentionDays?: number;
consentRequired?: boolean;
};
hipaa?: {
enabled?: boolean;
auditLogging?: boolean;
encryptionRequired?: boolean;
};
};
voiceComments?: boolean;
videoIntegration?: boolean;
mediaEditor?: boolean;
localAI?: {
enabled?: boolean;
models?: string[];
};
}
export declare class ArmorEditor {
private container;
private editor;
private toolbar;
private pluginManager;
private shortcutManager;
private performanceMonitor;
private commandPalette;
private mobileEnhancements;
private aiEnhancements;
private exportSystem;
private permissionsSystem;
private versionSystem;
private analyticsSystem;
private workflowSystem;
private realtimeCollaboration;
private wasmOptimizations;
private completeExportImport;
private completeLocalAI;
private completeMediaEditor;
private encryptionSystem;
private voiceComments;
private videoIntegration;
private ssoIntegration;
private complianceSystem;
private localAI;
private options;
private colorPicker;
private linkDialog;
private imageDialog;
private tableDialog;
private commentSidebar;
private trackChangesPanel;
private wordCountPanel;
private collaborators;
private comments;
private changes;
private autoSaveTimer;
private spellCheckEnabled;
private isSSR;
private undoStack;
private redoStack;
private maxUndoSteps;
private lastContent;
private isMobile;
private touchStartY;
private isVirtualScrolling;
private chunkSize;
constructor(options: EditorOptions);
private loadGoogleFonts;
private isNextJS;
private isNuxtJS;
private delayedInit;
static create(options: EditorOptions): Promise<ArmorEditor>;
private init;
private setupStyles;
private createToolbar;
private createToolbarButton;
private updateButtonActiveState;
private createFontSizeSelect;
private createFontFamilySelect;
private showColorPicker;
private applyColor;
private showLinkDialog;
private insertLink;
private showImageDialog;
private insertImage;
private makeImageResizable;
private showTableDialog;
private insertTable;
private insertBlockquote;
private insertCodeBlock;
private toggleTrackChanges;
private enableTrackChanges;
private renderChanges;
acceptChange(changeId: string): void;
rejectChange(changeId: string): void;
private updateTrackChangesDisplay;
private disableTrackChanges;
private toggleComments;
private createCommentSidebar;
private renderComments;
private addComment;
private toggleSpellCheck;
private spellCheckListener;
private setupSpellCheckListener;
private removeSpellCheckListener;
private runAdvancedSpellCheck;
private runBasicSpellCheck;
private highlightSpellingErrors;
private highlightBasicErrors;
private attachSpellCheckClickHandlers;
private showSpellCheckSuggestions;
private clearSpellCheckHighlights;
private addToCustomDictionary;
getSpellCheckOptions(): {
language?: string;
apiKey?: string;
customDictionary?: string[];
};
updateSpellCheckOptions(options: {
language?: string;
apiKey?: string;
customDictionary?: string[];
}): void;
private initializeAI;
private showAIAssistant;
private getAvailableProviders;
private getProviderConfig;
private processAIRequest;
private callAIProvider;
private callOpenAI;
private callAnthropic;
private callGoogle;
private callCohere;
private callHuggingFace;
private getAIPrompt;
private replaceSelectedText;
private analytics;
private trackEvent;
getAnalytics(): {
sessionDuration: number;
totalEvents: number;
events: {
type: string;
timestamp: number;
data?: any;
}[];
performance: {
contentLength: number;
wordCount: number;
};
};
private escapeRegex;
private isWordMisspelled;
private tryAlternativeSpellCheck;
private parseSpellCheckResponse;
private insertMathFormula;
private showMediaDialog;
private embedMedia;
private makeVideoResizable;
private extractYouTubeId;
private showMentions;
private exportToPdf;
private exportToWord;
private importFromWord;
private toggleWordCount;
private createWordCountPanel;
private updateWordCount;
private toggleFullscreen;
private setupAutoSave;
private setupCollaboration;
private initializeCollaboration;
private handleCollaborativeChange;
private handleSelectionChange;
private createCollaboratorsPanel;
private updateCollaboratorsDisplay;
private updateCollaboratorCursor;
private updateCollaboratorActivity;
private generateUserColor;
private simulateCollaborators;
private createEditor;
private handleInput;
private undoTimeout;
private handleKeydown;
private handlePaste;
private selectionTimeout;
private updateFormattingButtonStatesDebounced;
private handleMouseUp;
private handleKeyUp;
private handleFocus;
private handleDocumentSelectionChange;
private attachEvents;
private handleTouchStart;
private handleTouchMove;
private handleTouchEnd;
private updateFormattingButtonStates;
private isFormatActive;
private setButtonActiveState;
private saveUndoState;
private performUndo;
private performRedo;
private execCommand;
getContent(): string;
setContent(html: string): void;
private setupVirtualScrolling;
private splitContentIntoChunks;
private makeExistingMediaResizable;
private sanitizeHTML;
getText(): string;
focus(): void;
insertHTML(html: string): void;
getSelection(): Selection | null;
setReadOnly(readOnly: boolean): void;
isReadOnly(): boolean;
destroy(): void;
private handleImageMouseEnter;
private handleImageMouseLeave;
private handleCollaborativeInput;
private handleCollaborativeSelectionChange;
private applyTheme;
setTheme(themeName: string | Theme): void;
registerPlugin(plugin: Plugin): void;
unregisterPlugin(pluginName: string): void;
getPlugin(name: string): Plugin | undefined;
registerShortcut(shortcut: any): void;
getShortcuts(): import("./shortcuts").Shortcut[];
startMeasure(name: string): void;
endMeasure(name: string): void;
getPerformanceMetrics(): Record<string, any>;
showCommandPalette(): void;
registerCommand(command: any): void;
generateContent(prompt: string): Promise<string>;
addContentTemplate(template: any): void;
exportToPDF(options?: any): Promise<any>;
exportToMarkdown(): any;
exportToHTML(options?: any): any;
importFromMarkdown(markdown: string): Promise<void>;
setCurrentUser(user: any): void;
hasPermission(action: string, resource: string): boolean;
createVersion(message: string, author: any): import("./version-system").DocumentVersion | undefined;
restoreVersion(versionId: string): boolean;
getVersionHistory(): import("./version-system").DocumentVersion[];
showAnalyticsDashboard(): void;
getAnalyticsMetrics(): import("./analytics-system").AnalyticsMetrics | undefined;
startWorkflow(workflowId: string, documentId: string, initiatedBy: string): string;
showWorkflowDashboard(): void;
encryptContent(content: string): Promise<string>;
decryptContent(encryptedContent: string): Promise<string>;
startVoiceRecording(): void;
stopVoiceRecording(): void;
startVideoCall(): Promise<void>;
endVideoCall(): void;
getCurrentUser(): any;
editImage(imageUrl: string): Promise<void>;
}
export { themes, applyTheme, Theme } from './themes';
export { PluginManager, Plugin, wordCountPlugin, autoSavePlugin } from './plugins';
export { ShortcutManager, Shortcut } from './shortcuts';
export { PerformanceMonitor, debounce, throttle, VirtualScroll } from './performance';
export { CommandPalette, Command } from './command-palette';
export { MobileEnhancements } from './mobile-enhancements';
export { AIEnhancements, ContentTemplate } from './ai-enhancements';
export { CompleteExportImport } from './export-import-complete';
export { PermissionsSystem, User, UserRole, Permission } from './permissions-system';
export { VersionSystem, DocumentVersion } from './version-system';
export { AnalyticsSystem, AnalyticsEvent, AnalyticsMetrics } from './analytics-system';
export { WorkflowSystem, Workflow, WorkflowStep } from './workflow-system';
export { VoiceCommentsSystem, VoiceComment } from './voice-comments';
export { VideoIntegration, VideoCall } from './video-integration';
export { CompleteMediaEditor } from './media-editor-complete';
export { EncryptionSystem } from './encryption-system';
export { SSOIntegration, SSOConfig, UserProfile } from './sso-integration';
export { ComplianceSystem, ComplianceConfig, DataProcessingRecord } from './compliance-system';
export { CompleteLocalAI } from './local-ai-complete';