1 import type { DocumentRoleType } from '../Doc/DocumentRole'
2 import type { RtsMessagePayload } from '../Doc/RtsMessagePayload'
3 import type { EditorInitializationConfig } from '../EditorInitializationConfig'
4 import type { DataTypesThatDocumentCanBeExportedAs } from '../ExportableDataType'
5 import type { SerializedEditorState } from 'lexical'
6 import type { UserSettings } from '@proton/shared/lib/interfaces'
7 import type { YjsState } from '../YjsState'
8 import type { SyncedEditorStateValues } from '../State/SyncedEditorState'
10 export interface ClientRequiresEditorMethods {
11 receiveMessage(message: RtsMessagePayload): Promise<void>
12 performOpeningCeremony(): Promise<void>
13 performClosingCeremony(): Promise<void>
14 /** Returns the document Yjs state */
15 getDocumentState(): Promise<YjsState>
16 /** Returns the Lexical state of the editor, unrelated to the Yjs state */
17 getCurrentEditorState(): Promise<SerializedEditorState | undefined>
19 * A destructive operation that replaces the current editor state with the given state,
20 * used when restoring a document from history
22 replaceEditorState(state: SerializedEditorState): Promise<void>
23 getClientId(): Promise<number>
24 showEditor(): Promise<void>
25 showCommentsPanel(): Promise<void>
29 role: DocumentRoleType,
30 editorInitializationConfig?: EditorInitializationConfig,
32 handleCommentsChange(): Promise<void>
33 handleTypingStatusChange(threadId: string): Promise<void>
34 handleCreateCommentMarkNode(markID: string): Promise<void>
35 handleRemoveCommentMarkNode(markID: string): Promise<void>
36 handleResolveCommentMarkNode(markID: string): Promise<void>
37 handleUnresolveCommentMarkNode(markID: string): Promise<void>
38 changeLockedState(locked: boolean): Promise<void>
39 broadcastPresenceState(): Promise<void>
40 exportData(format: DataTypesThatDocumentCanBeExportedAs): Promise<Uint8Array>
41 printAsPDF(): Promise<void>
42 loadUserSettings(settings: UserSettings): Promise<void>
43 toggleDebugTreeView(): Promise<void>
44 handleIsSuggestionsFeatureEnabled(enabled: boolean): Promise<void>
47 property: keyof SyncedEditorStateValues,
48 value: SyncedEditorStateValues[keyof SyncedEditorStateValues],