@jager-ai/holy-editor
Version:
Rich text editor with Bible verse slash commands and PWA keyboard tracking, extracted from Holy Habit project
143 lines • 3.78 kB
TypeScript
/**
* HolyEditor Types
*
* Type definitions for the HolyEditor system
*/
export interface BibleVerse {
book: string;
chapter: number;
verse: number;
text: string;
}
export interface BibleVerseData {
verses: BibleVerse[];
isRange: boolean;
}
export interface BibleApiResponse {
success: boolean;
verses: BibleVerse[];
}
export interface EditorConfig {
apiEndpoint?: string;
enableSlashCommands?: boolean;
enableBibleVerses?: boolean;
enableToolbar?: boolean;
enablePWATracking?: boolean;
enableToasts?: boolean;
enableAutoSave?: boolean;
cacheEnabled?: boolean;
debounceMs?: number;
autoSaveInterval?: number;
autoSaveKey?: string;
colors?: string[];
colorNames?: string[];
enableTextFormatting?: boolean;
enablePWAKeyboard?: boolean;
keyboardSettings?: KeyboardTrackingSettings;
enableColorPicker?: boolean;
}
export interface SlashCommandMatch {
ref: string;
position: number;
fullMatch: string;
}
export interface PWAEnvironment {
isPWA: boolean;
isIOS: boolean;
isAndroid: boolean;
hasVisualViewport: boolean;
isAndroidChrome: boolean;
isSamsungInternet: boolean;
}
export interface KeyboardTrackingSettings {
threshold: number;
keyboardMin: number;
debounceTime: number;
}
export interface ToolbarButtonState {
action: string;
isActive: boolean;
}
export type FormatAction = 'bold' | 'underline' | 'heading1' | 'quote' | 'textcolor';
export interface ColorOption {
color: string;
name: string;
}
export interface ToastOptions {
message: string;
duration?: number;
type?: 'info' | 'success' | 'warning' | 'error';
}
export declare class EditorError extends Error {
code?: string;
originalError?: Error;
constructor(message: string, code?: string, originalError?: Error);
}
export declare class BibleApiError extends EditorError {
statusCode?: number;
constructor(message: string, statusCode?: number, originalError?: Error);
}
export type EditorEventHandler = (event: Event) => void;
export type KeyboardEventHandler = (event: KeyboardEvent) => void;
export type SelectionChangeHandler = () => void;
export interface EditorSelection {
range: Range;
selectedText: string;
hasSelection: boolean;
}
export interface FormatState {
bold: boolean;
underline: boolean;
heading1: boolean;
quote: boolean;
textcolor: boolean;
}
export interface BibleBookMapping {
[abbr: string]: string;
}
export interface VerseCache {
[ref: string]: BibleVerseData;
}
export interface PlatformInfo {
isIOS: boolean;
isAndroid: boolean;
isAndroidChrome: boolean;
isSamsungInternet: boolean;
isPWA: boolean;
hasVisualViewport: boolean;
}
export interface KeyboardOffsetData {
offset: number;
visualHeight?: number;
innerHeight: number;
keyboardHeight: number;
}
export interface EditorLifecycle {
onInit?: () => void;
onDestroy?: () => void;
onContentChange?: (content: string) => void;
onSelectionChange?: () => void;
onFormatChange?: (formatState: FormatState) => void;
}
export interface AutoSaveData {
content: string;
timestamp: number;
version: string;
editorId: string;
}
export interface AutoSaveOptions {
interval?: number;
key?: string;
maxSize?: number;
onSave?: (data: AutoSaveData) => void;
onRestore?: (data: AutoSaveData) => void;
onError?: (error: Error) => void;
}
export interface ExternalIntegration {
insertContent?: (content: string, position?: 'cursor' | 'end') => boolean;
getContent?: () => string;
setContent?: (content: string) => void;
focus?: () => void;
blur?: () => void;
}
//# sourceMappingURL=Editor.d.ts.map