1 import { type ErrorInfo } from 'react'
2 import type { UserState } from '@lexical/yjs'
3 import type { CommentInterface } from '../CommentInterface'
4 import type { CommentThreadInterface } from '../CommentThreadInterface'
5 import type { RtsMessagePayload } from '../Doc/RtsMessagePayload'
6 import type { BroadcastSource } from './BroadcastSource'
7 import type { WordCountInfoCollection } from '../WordCount/WordCountTypes'
8 import type { SuggestionSummaryType } from '../SuggestionType'
9 import type { EditorEvent, EditorEventData } from './EditorEvent'
11 export interface EditorRequiresClientMethods {
12 editorRequestsPropagationOfUpdate(message: RtsMessagePayload, debugSource: BroadcastSource): Promise<void>
13 editorReportingEvent(event: EditorEvent, data: EditorEventData[EditorEvent]): Promise<void>
15 getTypersExcludingSelf(threadId: string): Promise<string[]>
16 createComment(content: string, threadID: string): Promise<CommentInterface | undefined>
17 beganTypingInThread(threadID: string): Promise<void>
18 stoppedTypingInThread(threadID: string): Promise<void>
19 editComment(threadID: string, commentID: string, content: string): Promise<boolean>
20 deleteComment(threadID: string, commentID: string): Promise<boolean>
22 getAllThreads(): Promise<CommentThreadInterface[]>
24 commentContent: string,
26 createMarkNode?: boolean,
27 ): Promise<CommentThreadInterface | undefined>
28 createSuggestionThread(
30 commentContent: string,
31 suggestionType: SuggestionSummaryType,
32 ): Promise<CommentThreadInterface | undefined>
34 resolveThread(threadId: string): Promise<boolean>
35 unresolveThread(threadId: string): Promise<boolean>
37 acceptSuggestion(threadId: string, summary: string): Promise<boolean>
38 rejectSuggestion(threadId: string, summary?: string): Promise<boolean>
39 reopenSuggestion(threadId: string): Promise<boolean>
41 deleteThread(id: string): Promise<boolean>
42 markThreadAsRead(id: string): Promise<void>
44 handleAwarenessStateUpdate(states: UserState[]): Promise<void>
46 openLink(url: string): Promise<void>
50 * - irrecoverable: If true, will destroy the application instance entirely and display a blocking modal.
51 * Otherwise, will show a modal that can be dismissed.
53 reportUserInterfaceError(
55 extraInfo?: { irrecoverable?: boolean; errorInfo?: ErrorInfo; lockEditor?: boolean },
57 reportWordCount(wordCountInfo: WordCountInfoCollection): Promise<void>
58 updateFrameSize(size: number): void
59 showGenericAlertModal(message: string): void
61 fetchExternalImageAsBase64(url: string): Promise<string | undefined>