UNPKG

@atlaskit/editor-plugin-collab-edit

Version:

Collab Edit plugin for @atlaskit/editor-core

29 lines (28 loc) 2.15 kB
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics'; import type { CollabEditOptions, CollabParticipant } from '@atlaskit/editor-common/collab'; import { Transaction } from '@atlaskit/editor-prosemirror/state'; import type { EditorState, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state'; import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform'; import type { Step } from '@atlaskit/editor-prosemirror/transform'; import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view'; import { Decoration } from '@atlaskit/editor-prosemirror/view'; export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[]; export declare function getAvatarColor(str: string): { backgroundColor: string; index: number; textColor: string; }; export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string, fullName: string, isNudged: boolean) => Decoration[]; export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction; export declare const scrollToCollabCursor: (editorView: EditorView, participants: CollabParticipant[], sessionId: string | undefined, index: number, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => void; export declare const getPositionOfTelepointer: (sessionId: string, decorationSet: DecorationSet) => undefined | number; export declare const isReplaceStep: (step: Step) => step is ReplaceStep; export declare const originalTransactionHasMeta: (transaction: Transaction | ReadonlyTransaction, metaTag: string) => boolean; /** * Takes the transaction and editor state and checks if the transaction is considered organic change * @param tr Transaction * @returns boolean */ export declare const isOrganicChange: (tr: ReadonlyTransaction) => boolean; export type NudgeAnimationsMap = Map<string, number>; export declare const hasExistingNudge: (sessionId: string, nudgeAnimations: NudgeAnimationsMap) => boolean;