2023-10-24 10:57:17 -04:00
|
|
|
import { Emitter } from 'strict-event-emitter'
|
|
|
|
import { Project } from '../../../../types/project'
|
|
|
|
import { PermissionsLevel } from '@/features/ide-react/types/permissions-level'
|
2023-10-26 04:57:00 -04:00
|
|
|
import { ShareJsDoc } from '@/features/ide-react/editor/share-js-doc'
|
2023-10-24 10:57:17 -04:00
|
|
|
import { GotoLineOptions } from '@/features/ide-react/types/goto-line-options'
|
|
|
|
import { CursorPosition } from '@/features/ide-react/types/cursor-position'
|
2023-11-02 07:36:04 -04:00
|
|
|
import { FileTreeFindResult } from '@/features/ide-react/types/file-tree'
|
2023-10-24 10:57:17 -04:00
|
|
|
|
|
|
|
export type IdeEvents = {
|
|
|
|
'project:joined': [{ project: Project; permissionsLevel: PermissionsLevel }]
|
|
|
|
|
2023-10-26 04:57:00 -04:00
|
|
|
// TODO: MIGRATION: This doesn't seem to be used. Investigate whether it can be removed
|
|
|
|
'document:opened': [doc: ShareJsDoc]
|
|
|
|
|
|
|
|
'document:closed': [doc: ShareJsDoc]
|
|
|
|
'doc:changed': [{ doc_id: string }]
|
|
|
|
'doc:saved': [{ doc_id: string }]
|
|
|
|
'doc:opened': []
|
|
|
|
'ide:opAcknowledged': [{ doc_id: string; op: any }]
|
|
|
|
'store-doc-position': []
|
2023-10-24 10:57:17 -04:00
|
|
|
'editor:gotoOffset': [gotoOffset: number]
|
|
|
|
'editor:gotoLine': [options: GotoLineOptions]
|
|
|
|
'cursor:editor:update': [position: CursorPosition]
|
2023-10-26 04:57:00 -04:00
|
|
|
'outline-toggled': [isOpen: boolean]
|
2023-10-24 10:57:17 -04:00
|
|
|
'cursor:editor:syncToPdf': []
|
|
|
|
'scroll:editor:update': []
|
|
|
|
'comment:start_adding': []
|
2023-10-26 04:57:00 -04:00
|
|
|
'references:should-reindex': []
|
|
|
|
|
2023-11-02 07:36:04 -04:00
|
|
|
'entity:deleted': [entity: FileTreeFindResult]
|
2023-10-24 10:57:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export type IdeEventEmitter = Emitter<IdeEvents>
|
|
|
|
|
|
|
|
export function createIdeEventEmitter(): IdeEventEmitter {
|
|
|
|
return new Emitter<IdeEvents>()
|
|
|
|
}
|