MCPcopy Index your code
hub / github.com/PaperDebugger/paperdebugger / DocumentAdapter

Interface DocumentAdapter

webapp/_webapp/src/adapters/types.ts:35–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35export interface DocumentAdapter {
36 /**
37 * Platform identifier for conditional UI rendering
38 */
39 readonly platform: "overleaf" | "word" | "browser";
40
41 /**
42 * Get the full document text
43 */
44 getFullText(): Promise<string>;
45
46 /**
47 * Get the currently selected text and its context
48 */
49 getSelection(): Promise<SelectionInfo | null>;
50
51 /**
52 * Insert text at the current cursor position
53 * @param text - Text to insert
54 * @param location - Optional: 'cursor' (default), 'start', or 'end'
55 */
56 insertText(text: string, location?: "cursor" | "start" | "end"): Promise<void>;
57
58 /**
59 * Replace the current selection with new text
60 * @param text - Text to replace with
61 * @param rangeId - Optional range identifier from getSelection()
62 */
63 replaceSelection(text: string, rangeId?: string): Promise<void>;
64
65 /**
66 * Subscribe to selection change events
67 * @param callback - Called when selection changes
68 * @returns Cleanup function to unsubscribe
69 */
70 onSelectionChange?(callback: (selection: SelectionInfo | null) => void): () => void;
71
72 /**
73 * Check if the adapter is ready/connected
74 */
75 isReady(): boolean;
76
77 /**
78 * Optional: Get project/document identifier
79 */
80 getDocumentId?(): string;
81}
82
83/**
84 * Type for adapter props passed to Web Component

Callers

nothing calls this directly

Implementers 2

OverleafAdapterwebapp/_webapp/src/adapters/document-a
WordAdapterwebapp/office/src/adapters/document-ad

Calls

no outgoing calls

Tested by

no test coverage detected