Cloud collaborator refactoring (#6424)

This commit is contained in:
Alexander Onnikov
2024-08-29 15:10:37 +07:00
committed by GitHub
parent 42b19c39c7
commit 4ff8a4559f
52 changed files with 762 additions and 998 deletions
+2 -2
View File
@@ -17,7 +17,7 @@
import { type Class, type Ref } from '@hcengineering/core'
import { type Asset, type IntlString, type Metadata, type Plugin, plugin } from '@hcengineering/platform'
import { type TextEditorExtensionFactory, type RefInputActionItem, TextEditorAction } from './types'
import { type TextEditorExtensionFactory, type RefInputActionItem, TextEditorAction, CollaboratorType } from './types'
/**
* @public
@@ -31,7 +31,7 @@ export default plugin(textEditorId, {
TextEditorAction: '' as Ref<Class<TextEditorAction>>
},
metadata: {
CollaboratorUrl: '' as Metadata<string>
Collaborator: '' as Metadata<CollaboratorType>
},
string: {
TableOfContents: '' as IntlString,
+11 -5
View File
@@ -6,6 +6,12 @@ import { type AnyExtension, type Content, type Editor, type SingleCommands } fro
import { type ParseOptions } from '@tiptap/pm/model'
export type { AnyExtension, Editor } from '@tiptap/core'
/**
* @public
*/
export type CollaboratorType = 'local' | 'cloud'
/**
* @public
*/
@@ -122,8 +128,7 @@ export interface CollaborationUser {
}
/** @public */
export interface CollaborationUserState {
clientId: number
export interface AwarenessState {
user: CollaborationUser
cursor?: {
anchor: RelativePosition
@@ -133,9 +138,10 @@ export interface CollaborationUserState {
}
/** @public */
export interface AwarenessChangeEvent {
states: CollaborationUserState[]
}
export type AwarenessClientId = number
/** @public */
export type AwarenessStateMap = Map<AwarenessClientId, AwarenessState>
export type TextEditorMode = 'full' | 'compact'
export type ExtensionCreator = (mode: TextEditorMode, ctx: any) => AnyExtension