@atlaskit/editor-plugin-collab-edit 12.0.15 → 12.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/collabEditPlugin/package.json +1 -8
  3. package/collabEditPluginType/package.json +1 -8
  4. package/package.json +2 -2
  5. package/types/package.json +1 -8
  6. package/dist/types-ts4.5/collabEditPlugin.d.ts +0 -2
  7. package/dist/types-ts4.5/collabEditPluginType.d.ts +0 -47
  8. package/dist/types-ts4.5/entry-points/collabEditPlugin.d.ts +0 -1
  9. package/dist/types-ts4.5/entry-points/collabEditPluginType.d.ts +0 -1
  10. package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
  11. package/dist/types-ts4.5/index.d.ts +0 -3
  12. package/dist/types-ts4.5/pm-plugins/actions.d.ts +0 -13
  13. package/dist/types-ts4.5/pm-plugins/analytics.d.ts +0 -6
  14. package/dist/types-ts4.5/pm-plugins/events/handlers.d.ts +0 -25
  15. package/dist/types-ts4.5/pm-plugins/events/initialize.d.ts +0 -18
  16. package/dist/types-ts4.5/pm-plugins/events/send-transaction.d.ts +0 -14
  17. package/dist/types-ts4.5/pm-plugins/filterAnalytics.d.ts +0 -9
  18. package/dist/types-ts4.5/pm-plugins/main/index.d.ts +0 -9
  19. package/dist/types-ts4.5/pm-plugins/main/plugin-key.d.ts +0 -3
  20. package/dist/types-ts4.5/pm-plugins/main/plugin-state.d.ts +0 -27
  21. package/dist/types-ts4.5/pm-plugins/mergeUnconfirmed.d.ts +0 -14
  22. package/dist/types-ts4.5/pm-plugins/monitor-organic-changes.d.ts +0 -39
  23. package/dist/types-ts4.5/pm-plugins/native-collab-provider-plugin.d.ts +0 -7
  24. package/dist/types-ts4.5/pm-plugins/participants.d.ts +0 -14
  25. package/dist/types-ts4.5/pm-plugins/preserve-node-identity.d.ts +0 -28
  26. package/dist/types-ts4.5/pm-plugins/track-and-filter-spamming-steps.d.ts +0 -36
  27. package/dist/types-ts4.5/pm-plugins/track-last-organic-change.d.ts +0 -5
  28. package/dist/types-ts4.5/pm-plugins/track-ncs-initialization.d.ts +0 -5
  29. package/dist/types-ts4.5/pm-plugins/track-reconnection-conflict.d.ts +0 -5
  30. package/dist/types-ts4.5/pm-plugins/track-step-metrics.d.ts +0 -48
  31. package/dist/types-ts4.5/pm-plugins/track-steps.d.ts +0 -81
  32. package/dist/types-ts4.5/pm-plugins/utils.d.ts +0 -28
  33. package/dist/types-ts4.5/types/index.d.ts +0 -44
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 12.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 12.0.15
4
10
 
5
11
  ### Patch Changes
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/collabEditPlugin.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/collabEditPlugin.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/collabEditPlugin.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/collabEditPlugin.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/collabEditPlugin.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/collabEditPluginType.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/collabEditPluginType.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/collabEditPluginType.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/collabEditPluginType.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/collabEditPluginType.d.ts"
15
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "12.0.15",
3
+ "version": "12.0.16",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/frontend-utilities": "^3.4.0",
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
41
41
  "@atlaskit/prosemirror-collab": "^0.22.0",
42
- "@atlaskit/tmp-editor-statsig": "^102.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
43
43
  "@atlaskit/tokens": "^13.4.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "memoize-one": "^6.0.0"
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/types.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/types.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/types.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/types.d.ts"
15
8
  }
@@ -1,2 +0,0 @@
1
- import type { CollabEditPlugin } from './collabEditPluginType';
2
- export declare const collabEditPlugin: CollabEditPlugin;
@@ -1,47 +0,0 @@
1
- import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { JSONNode } from '@atlaskit/editor-json-transformer';
3
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
- import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
7
- import type { Mark } from '@atlaskit/editor-prosemirror/model';
8
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
9
- import type { CollabEditPluginSharedState, CollabSendableSteps, PrivateCollabEditOptions } from './types';
10
- export type CollabEditPluginDependencies = [
11
- OptionalPlugin<FeatureFlagsPlugin>,
12
- OptionalPlugin<AnalyticsPlugin>,
13
- OptionalPlugin<EditorViewModePlugin>,
14
- OptionalPlugin<ConnectivityPlugin>
15
- ];
16
- export type CollabEditPluginOptions = PrivateCollabEditOptions;
17
- export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
18
- actions: {
19
- addInlineCommentMark: (props: {
20
- from: number;
21
- mark: Mark;
22
- to: number;
23
- }) => boolean;
24
- addInlineCommentNodeMark: (props: {
25
- mark: Mark;
26
- pos: number;
27
- }) => boolean;
28
- getAvatarColor: (str: string) => {
29
- backgroundColor: string;
30
- index: number;
31
- textColor: string;
32
- };
33
- getCurrentCollabState: () => {
34
- content: JSONNode | undefined;
35
- sendableSteps: CollabSendableSteps | undefined | null;
36
- version: number | undefined;
37
- };
38
- isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
39
- validatePMJSONDocument: (doc: any) => boolean;
40
- };
41
- commands: {
42
- nudgeTelepointer: (sessionId: string) => EditorCommand;
43
- };
44
- dependencies: CollabEditPluginDependencies;
45
- pluginConfiguration: CollabEditPluginOptions;
46
- sharedState: CollabEditPluginSharedState;
47
- }>;
@@ -1 +0,0 @@
1
- export { collabEditPlugin } from '../collabEditPlugin';
@@ -1 +0,0 @@
1
- export type { CollabEditPlugin, CollabEditPluginOptions, CollabEditPluginDependencies, } from '../collabEditPluginType';
@@ -1 +0,0 @@
1
- export type { CollabInitializedMetadata, LastOrganicChangeMetadata, CollabEditPluginSharedState, ReadOnlyParticipants, PrivateCollabEditOptions, CollabSendableSteps, } from '../types/index';
@@ -1,3 +0,0 @@
1
- export { collabEditPlugin } from './collabEditPlugin';
2
- export type { CollabEditPlugin, CollabEditPluginOptions, CollabEditPluginDependencies, } from './collabEditPluginType';
3
- export type { CollabInitializedMetadata, LastOrganicChangeMetadata, CollabEditPluginSharedState, ReadOnlyParticipants, PrivateCollabEditOptions, CollabSendableSteps, } from './types';
@@ -1,13 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { CollabEventConnectionData, CollabEventInitData, CollabEventPresenceData, CollabEventRemoteData, CollabSendableSelection, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
3
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { PrivateCollabEditOptions } from '../types';
6
- export declare const registerAllCustomSteps: () => void;
7
- export declare const handleInit: (initData: CollabEventInitData, view: EditorView, options?: PrivateCollabEditOptions, editorAnalyticsApi?: EditorAnalyticsAPI) => void;
8
- export declare const handleConnection: (connectionData: CollabEventConnectionData, view: EditorView) => void;
9
- export declare const handlePresence: (presenceData: CollabEventPresenceData, view: EditorView) => void;
10
- export declare const applyRemoteData: (remoteData: CollabEventRemoteData, view: EditorView, options: PrivateCollabEditOptions) => void;
11
- export declare const applyRemoteSteps: (json: any[], view: EditorView, userIds?: (number | string)[], options?: PrivateCollabEditOptions) => void;
12
- export declare const handleTelePointer: (telepointerData: CollabTelepointerPayload, view: EditorView) => void;
13
- export declare const getSendableSelection: (selection: Selection) => CollabSendableSelection;
@@ -1,6 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- export declare const addSynchronyErrorAnalytics: (state: EditorState, tr: Transaction, featureFlags: FeatureFlags, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => (error: Error) => Transaction;
5
- export type EntityEventType = 'error' | 'disconnected';
6
- export declare const addSynchronyEntityAnalytics: (state: EditorState, tr: Transaction) => (type: EntityEventType, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Transaction;
@@ -1,25 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { CollabEditProvider, CollabEventConflictPayload, CollabEventConnectionData, CollabEventInitData, CollabEventLocalStepData, CollabEventPresenceData, CollabEventRemoteData, CollabEvents, CollabTelepointerPayload } from '@atlaskit/editor-common/collab';
3
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { PrivateCollabEditOptions } from '../../types';
7
- export type SynchronyEntity = {
8
- off: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
9
- on: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
10
- };
11
- export interface CollabHandlers {
12
- connectedHandler: (data: CollabEventConnectionData) => void;
13
- dataConflictHandler: (data: CollabEventConflictPayload) => void;
14
- dataHandler: (data: CollabEventRemoteData) => void;
15
- entityHandler: ({ entity }: {
16
- entity: SynchronyEntity;
17
- }) => void;
18
- errorHandler: (error: any) => void;
19
- initHandler: (data: CollabEventInitData) => void;
20
- localStepsHandler: (data: CollabEventLocalStepData) => void;
21
- presenceHandler: (data: CollabEventPresenceData) => void;
22
- telepointerHandler: (data: CollabTelepointerPayload) => void;
23
- }
24
- export type Cleanup = () => void;
25
- export declare const subscribe: (currentDeps_0: EditorView, currentDeps_1: CollabEditProvider<CollabEvents>, currentDeps_2: PrivateCollabEditOptions, currentDeps_3: FeatureFlags, currentDeps_4?: ProviderFactory | undefined, currentDeps_5?: EditorAnalyticsAPI | undefined) => Cleanup;
@@ -1,18 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
3
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
5
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { CollabEditPlugin } from '../../collabEditPluginType';
7
- import type { PrivateCollabEditOptions } from '../../types';
8
- import type { Cleanup } from './handlers';
9
- type Props = {
10
- editorAnalyticsApi: EditorAnalyticsAPI | undefined;
11
- featureFlags: FeatureFlags;
12
- options: PrivateCollabEditOptions;
13
- pluginInjectionApi?: ExtractInjectionAPI<CollabEditPlugin> | undefined;
14
- providerFactory: ProviderFactory;
15
- view: EditorView;
16
- };
17
- export declare const initialize: ({ options, providerFactory, view, featureFlags, editorAnalyticsApi, pluginInjectionApi, }: Props) => (provider: CollabEditProvider) => Cleanup;
18
- export {};
@@ -1,14 +0,0 @@
1
- import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
2
- import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
3
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- type Props = {
5
- hideTelecursorOnLoad: boolean;
6
- newEditorState: EditorState;
7
- oldEditorState: EditorState;
8
- originalTransaction: Readonly<Transaction>;
9
- transactions: readonly Transaction[];
10
- useNativePlugin: boolean;
11
- viewMode?: ViewMode;
12
- };
13
- export declare const sendTransaction: ({ originalTransaction, transactions, oldEditorState, newEditorState, useNativePlugin, viewMode, hideTelecursorOnLoad, }: Props) => (provider: CollabEditProvider) => void;
14
- export {};
@@ -1,9 +0,0 @@
1
- import { Rebaseable } from '@atlaskit/prosemirror-collab';
2
- /**
3
- * Filter out AnalyticsStep from the steps.
4
- *
5
- * @param steps Rebaseable steps
6
- * @returns Rebaseable steps
7
- * @example
8
- */
9
- export declare function filterAnalyticsSteps(steps: Rebaseable[]): Rebaseable[];
@@ -1,9 +0,0 @@
1
- import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
2
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
6
- import type { CollabEditPlugin } from '../../collabEditPluginType';
7
- import type { PrivateCollabEditOptions, ProviderCallback } from '../../types';
8
- import { PluginState } from './plugin-state';
9
- export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, providerResolver: (value: CollabEditProvider) => void, collabProviderCallback: ProviderCallback, options: PrivateCollabEditOptions, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<CollabEditPlugin> | undefined) => SafePlugin<PluginState>;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { PluginState as CollabPluginState } from './plugin-state';
3
- export declare const pluginKey: PluginKey<CollabPluginState>;
@@ -1,27 +0,0 @@
1
- import type { ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
2
- import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import type { ReadOnlyParticipants } from '../../types';
4
- import { Participants } from '../participants';
5
- import type { NudgeAnimationsMap } from '../utils';
6
- /**
7
- * Returns position where it's possible to place a decoration.
8
- */
9
- export declare const getValidPos: (tr: ReadonlyTransaction, pos: number) => number;
10
- export declare class PluginState {
11
- private decorationSet;
12
- private participants;
13
- private nudgeAnimations;
14
- private onError;
15
- private sid?;
16
- isReady: boolean;
17
- get decorations(): DecorationSet;
18
- get activeParticipants(): ReadOnlyParticipants;
19
- get sessionId(): string | undefined;
20
- constructor(decorations: DecorationSet, participants: Participants, sessionId?: string, collabInitalised?: boolean, onError?: (err: Error) => void, nudgeAnimations?: NudgeAnimationsMap);
21
- getFullName(sessionId: string): string;
22
- getInitial(sessionId: string): string;
23
- getPresenceId(sessionId: string): string;
24
- apply(tr: ReadonlyTransaction): PluginState;
25
- static eq(a: PluginState, b: PluginState): boolean;
26
- static init(config: any): PluginState;
27
- }
@@ -1,14 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import { Rebaseable } from '@atlaskit/prosemirror-collab';
3
- import type { CollabEditPlugin } from '../collabEditPluginType';
4
- /**
5
- * Merge a set of steps together to reduce the total number of steps stored in memory.
6
- *
7
- * All steps passing through here should be "lockable" (ie. can be locked by the document service)
8
- * so that it can be indicated they have already been sent (or are about to be sent) to the backend
9
- * and cannot be merged.
10
- *
11
- * @param steps Rebaseable steps
12
- * @returns Rebaseable steps
13
- */
14
- export declare function mergeUnconfirmedSteps(steps: Rebaseable[], api: ExtractInjectionAPI<CollabEditPlugin> | undefined): Rebaseable[];
@@ -1,39 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { CollabEditPlugin } from '../collabEditPluginType';
4
- export type OrganicMetadataAnalytics = {
5
- endedAt: number;
6
- isFirstChange: boolean;
7
- startedAt: number;
8
- stepTypesAmount: {
9
- [key: string]: number;
10
- };
11
- transactions: number;
12
- };
13
- type TrackProps = {
14
- api: ExtractInjectionAPI<CollabEditPlugin> | undefined;
15
- newEditorState: EditorState;
16
- oldEditorState: EditorState;
17
- onDataProcessed: (data: OrganicMetadataAnalytics[]) => void;
18
- transactions: Readonly<Transaction[]>;
19
- };
20
- type Scheduler = {
21
- postTask: (cb: () => void, options: {
22
- delay: number;
23
- priority: 'background';
24
- }) => Promise<unknown>;
25
- };
26
- export declare const getScheduler: (obj: any) => Scheduler | null;
27
- /**
28
- * Tracks the steps sent by the client by storing them in a cache and scheduling a task to process them. Once the steps are processed, the onDataProcessed callabck will be called.
29
- *
30
- * This is a non-critical code. If the browser doesn't support the Scheduler API https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/
31
- *
32
- * @param {TrackProps} props - The properties required for tracking steps.
33
- * @param {ExtractInjectionAPI<CollabEditPlugin> | undefined} props.api - The API for the CollabEdit plugin.
34
- * @param {EditorState} props.newEditorState - The new editor state.
35
- * @param {Readonly<Transaction[]>} props.transactions - The transactions that contain the steps.
36
- * @param {(data: OrganicMetadataAnalytics[]) => void} props.onDataProcessed - Callback function to be called with the processed data.
37
- */
38
- export declare const monitorOrganic: ({ newEditorState, oldEditorState, transactions, onDataProcessed, }: TrackProps) => void;
39
- export {};
@@ -1,7 +0,0 @@
1
- import type { CollabEditProvider, CollabEvents } from '@atlaskit/editor-common/collab';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
- export declare const nativeCollabProviderPlugin: ({ providerPromise, }: {
5
- providerPromise: Promise<CollabEditProvider>;
6
- }) => SafePlugin<CollabEditProvider<CollabEvents> | null>;
7
- export declare const getCollabProvider: (editorState: EditorState) => CollabEditProvider | null;
@@ -1,14 +0,0 @@
1
- import type { CollabParticipant } from '@atlaskit/editor-common/collab';
2
- import type { ReadOnlyParticipants } from '../types';
3
- export declare class Participants implements ReadOnlyParticipants {
4
- private participants;
5
- constructor(participants?: Map<string, CollabParticipant>);
6
- add(data: CollabParticipant[]): Participants;
7
- remove(sessionIds: string[]): Participants;
8
- update(sessionId: string, lastActive: number): Participants;
9
- updateCursorPos(sessionId: string, cursorPos: number): Participants;
10
- toArray(): CollabParticipant[];
11
- get(sessionId: string): CollabParticipant | undefined;
12
- size(): number;
13
- eq(other: ReadOnlyParticipants): boolean;
14
- }
@@ -1,28 +0,0 @@
1
- import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- /**
3
- * Walk two Fragments (old and new) and return a Fragment that reuses old node
4
- * references wherever structurally equal (`node.eq()` returns true).
5
- *
6
- * This preserves referential identity (`===`) for unchanged subtrees, which is
7
- * critical for ProseMirror's view reconciliation performance. The `preMatch`
8
- * optimisation in `prosemirror-view/src/viewdesc.ts` uses `===` to fast-match
9
- * nodes against existing view descriptors. When all nodes are fresh objects
10
- * (e.g. after `Node.fromJSON` in `replaceDocument`), `preMatch` fails for
11
- * everything, and the fallback scan in `syncToMarks` is limited to 3
12
- * positions — causing mark wrappers to be destroyed and recreated when widget
13
- * decorations (gap cursor, telepointers, block controls) shift indices beyond
14
- * that window. The destroyed mark wrappers take their React nodeviews with
15
- * them, causing visible flicker.
16
- *
17
- * By preserving identity here, we ensure `preMatch` succeeds for unchanged
18
- * subtrees, preventing unnecessary mark wrapper destruction and React nodeview
19
- * re-mounting.
20
- *
21
- * @param oldFragment - Fragment from the current editor state (holds existing node references)
22
- * @param newFragment - Fragment parsed from incoming document (fresh node objects)
23
- * @returns A Fragment that reuses old node references where possible
24
- *
25
- * @see https://hello.jira.atlassian.cloud/browse/EDITOR-5277
26
- * @see https://hello.jira.atlassian.cloud/browse/EDITOR-4424
27
- */
28
- export declare function preserveNodeIdentity(oldFragment: Fragment, newFragment: Fragment): Fragment;
@@ -1,36 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
5
- import type { TrackSpammingStepsMetadata } from '../types';
6
- export type RecentTransactionTimestamp = {
7
- steps: Step[];
8
- timestamp: number;
9
- };
10
- export type RecentTransactionTimestamps = Map<string, RecentTransactionTimestamp>;
11
- export type TrackFilteredTransaction = (tr: Transaction) => void;
12
- export type SanitizedFilteredStep = {
13
- attr?: string;
14
- markType?: string;
15
- stepInstance?: string;
16
- stepType: string;
17
- };
18
- /**
19
- * Sanitizes a given ProseMirror step by extracting its type and non-UCG relevant attributes.
20
- *
21
- * @param {Step} step - The ProseMirror step to be sanitized.
22
- * @returns {SanitizedFilteredStep} - The sanitized step with only necessary information.
23
- *
24
- * @example
25
- * ```
26
- * const step = new AttrStep(10, 'colwidth', [123, 451] );
27
- * const sanitized = sanitizeFilteredStep(step);
28
- *
29
- * // Output: { stepType: 'attr', stepInstance: 'AttrStep', attr: 'example' }
30
- * ```
31
- */
32
- export declare const sanitizeFilteredStep: (step: Step) => SanitizedFilteredStep;
33
- export declare const createFilterTransaction: (recentTransactionsTimestamps: RecentTransactionTimestamps, trackFilteredTransaction: TrackFilteredTransaction) => (tr: Transaction) => boolean;
34
- export declare function generateTransactionKey(tr: Transaction): string;
35
- export declare const trackSpammingStepsPluginKey: PluginKey<TrackSpammingStepsMetadata>;
36
- export declare const createPlugin: (trackFilteredTransaction: TrackFilteredTransaction) => SafePlugin<TrackSpammingStepsMetadata>;
@@ -1,5 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { LastOrganicChangeMetadata } from '../types';
4
- export declare const trackLastOrganicChangePluginKey: PluginKey<LastOrganicChangeMetadata>;
5
- export declare const createPlugin: () => SafePlugin<LastOrganicChangeMetadata>;
@@ -1,5 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { CollabInitializedMetadata } from '../types';
4
- export declare const trackNCSInitializationPluginKey: PluginKey<CollabInitializedMetadata>;
5
- export declare const createPlugin: () => SafePlugin<CollabInitializedMetadata>;
@@ -1,5 +0,0 @@
1
- import type { CollabEventConflictPayload } from '@atlaskit/editor-common/collab';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- export declare const trackLastRemoteConflictPluginKey: PluginKey<CollabEventConflictPayload>;
5
- export declare const createPlugin: () => SafePlugin<CollabEventConflictPayload | undefined>;
@@ -1,48 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
3
- import type { CollabEditPlugin } from '../collabEditPluginType';
4
- type StepSessionMetrics = {
5
- maxStepSize: number;
6
- numberOfSteps: number;
7
- stepSizeSumForP90: number[];
8
- totalStepSize: number;
9
- };
10
- /**
11
- * Gets the current step session metrics for a given session ID
12
- * If the session ID does not exist, it initializes a new metrics object.
13
- * It calculates the total size of the steps, the number of steps,
14
- * the maximum step size, and the sum of step sizes for P90 calculation.
15
- *
16
- * @param metrics - The existing metrics object from local storage.
17
- * @param sessionId - The session ID for which to get the metrics.
18
- * @param steps - The steps to calculate the metrics from.
19
- * @returns The updated step session metrics for the given session ID.
20
- */
21
- export declare const getNcsSessionStepMetrics: (metrics: {
22
- [sessionId: string]: StepSessionMetrics;
23
- }, sessionId: string, steps: Step[]) => StepSessionMetrics;
24
- /**
25
- * Gets the current active sessions from local storage
26
- * If the session ID does not exist, it initializes a new active session.
27
- *
28
- * This is used in the ncsStepMetricsPlugin to determine if the session is still active
29
- * before sending the ncs steps analytics event.
30
- *
31
- * @param sessionId - The session ID to check or update in local storage.
32
- * @returns void
33
- */
34
- export declare const updateNcsActiveSessions: (sessionId: string) => void;
35
- type UpdateNcsSessionStepMetricProps = {
36
- api: ExtractInjectionAPI<CollabEditPlugin> | undefined;
37
- steps: Step[];
38
- };
39
- /**
40
- * Updates the step session metrics in local storage for a given session ID.
41
- * It calculates the metrics based on the provided steps and updates the storage.
42
- *
43
- * @param api - The API to access the collab edit plugin.
44
- * @param steps - The steps to calculate the metrics from.
45
- * @return void
46
- */
47
- export declare const updateNcsSessionStepMetrics: ({ api, steps, }: UpdateNcsSessionStepMetricProps) => void;
48
- export {};
@@ -1,81 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
4
- import type { CollabEditPlugin } from '../collabEditPluginType';
5
- export type SanitizedStep = {
6
- attr?: string;
7
- markType?: string;
8
- stepType: string;
9
- };
10
- export type StepMetadataAnalytics = {
11
- endedAt: number;
12
- startedAt: number;
13
- stepTypesAmount: {
14
- [key: string]: number;
15
- };
16
- };
17
- /**
18
- * Sanitizes a given ProseMirror step by extracting its type and non-UCG relevant attributes.
19
- *
20
- * @param {Step} step - The ProseMirror step to be sanitized.
21
- * @returns {SanitizedStep} - The sanitized step with only necessary information.
22
- *
23
- * @example
24
- * ```
25
- * const step = new AttrStep(10, 'colwidth', [123, 451] );
26
- * const sanitized = sanitizeStep(step);
27
- *
28
- * // Output: { stepType: 'attr', attr: 'example' }
29
- * ```
30
- */
31
- export declare const sanitizeStep: (step: Step) => SanitizedStep;
32
- /**
33
- * Groups sanitized steps by their type and counts their occurrences.
34
- *
35
- * @param {SanitizedStep[]} sanitizedSteps - An array of sanitized steps.
36
- * @returns {Record<string, number>} - An object where keys are step types and values are their counts.
37
- *
38
- * @example
39
- * ```
40
- * const input = [
41
- * { stepType: 'attr', attr: 'colwidth' },
42
- * { stepType: 'mark', markType: 'bold' },
43
- * { stepType: 'attr', attr: 'colwidth' }
44
- * ];
45
- *
46
- * const grouped = groupSteps(input);
47
- * // Output: { 'attr_example': 2, 'mark_bold': 1 }
48
- * ```
49
- */
50
- export declare const groupSteps: (sanitizedSteps: SanitizedStep[]) => Record<string, number>;
51
- /**
52
- * Processes the steps metadata from the cache and calls the callback function with the processed data.
53
- *
54
- * @param {CacheType} cache - A cache containing steps metadata.
55
- * @param {(data: StepMetadataAnalytics[]) => void} onTrackDataProcessed - Callback function to be called with the processed data.
56
- */
57
- export declare const task: (cache: CacheType, onTrackDataProcessed: (data: StepMetadataAnalytics[]) => void) => void;
58
- export type CacheType = Map<number, {
59
- endedAt: number;
60
- startedAt: number;
61
- steps: ReadonlyArray<Step>;
62
- }>;
63
- type TrackProps = {
64
- api: ExtractInjectionAPI<CollabEditPlugin> | undefined;
65
- newEditorState: EditorState;
66
- onTrackDataProcessed: (data: StepMetadataAnalytics[]) => void;
67
- transactions: Readonly<Transaction[]>;
68
- };
69
- /**
70
- * Tracks the steps sent by the client by storing them in a cache and scheduling a task to process them. Once the steps are processed, the onTrackDataProcessed callabck will be called.
71
- *
72
- * This is a non-critical code. If the browser doesn't support the Scheduler API https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/
73
- *
74
- * @param {TrackProps} props - The properties required for tracking steps.
75
- * @param {ExtractInjectionAPI<CollabEditPlugin> | undefined} props.api - The API for the CollabEdit plugin.
76
- * @param {EditorState} props.newEditorState - The new editor state.
77
- * @param {Readonly<Transaction[]>} props.transactions - The transactions that contain the steps.
78
- * @param {(data: StepMetadataAnalytics[]) => void} props.onTrackDataProcessed - Callback function to be called with the processed data.
79
- */
80
- export declare const track: ({ api, newEditorState, transactions, onTrackDataProcessed, }: TrackProps) => void;
81
- export {};
@@ -1,28 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { CollabEditOptions, CollabParticipant } from '@atlaskit/editor-common/collab';
3
- import { Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { EditorState, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
5
- import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
6
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
7
- import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
- export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
10
- export declare function getAvatarColor(str: string): {
11
- backgroundColor: string;
12
- index: number;
13
- textColor: string;
14
- };
15
- export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string, fullName: string, isNudged: boolean) => Decoration[];
16
- export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction;
17
- export declare const scrollToCollabCursor: (editorView: EditorView, participants: CollabParticipant[], sessionId: string | undefined, index: number, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => void;
18
- export declare const getPositionOfTelepointer: (sessionId: string, decorationSet: DecorationSet) => undefined | number;
19
- export declare const isReplaceStep: (step: Step) => step is ReplaceStep;
20
- export declare const originalTransactionHasMeta: (transaction: Transaction | ReadonlyTransaction, metaTag: string) => boolean;
21
- /**
22
- * Takes the transaction and editor state and checks if the transaction is considered organic change
23
- * @param tr Transaction
24
- * @returns boolean
25
- */
26
- export declare const isOrganicChange: (tr: ReadonlyTransaction) => boolean;
27
- export type NudgeAnimationsMap = Map<string, number>;
28
- export declare const hasExistingNudge: (sessionId: string, nudgeAnimations: NudgeAnimationsMap) => boolean;
@@ -1,44 +0,0 @@
1
- import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
4
- export type PrivateCollabEditOptions = CollabEditOptions & {
5
- hideTelecursorOnLoad?: boolean;
6
- onSyncUpError?: SyncUpErrorFunction;
7
- sanitizePrivateContent?: boolean;
8
- };
9
- export type ProviderCallback = <ReturnType>(codeToExecute: (provider: CollabEditProvider) => ReturnType | undefined, onError?: (err: Error) => void) => Promise<ReturnType | undefined> | undefined;
10
- export type ProviderBuilder = (collabEditProviderPromise: Promise<CollabEditProvider>) => ProviderCallback;
11
- export interface ReadOnlyParticipants {
12
- eq: (other: ReadOnlyParticipants) => boolean;
13
- get: (sessionId: string) => CollabParticipant | undefined;
14
- toArray: () => ReadonlyArray<CollabParticipant>;
15
- }
16
- export type CollabInitializedMetadata = {
17
- collabInitialisedAt: null | number;
18
- firstChangeAfterInitAt: null | number;
19
- firstContentBodyChangeAfterInitAt: null | number;
20
- };
21
- export type LastOrganicChangeMetadata = {
22
- lastLocalOrganicBodyChangeAt: null | number;
23
- lastLocalOrganicChangeAt: null | number;
24
- lastRemoteOrganicBodyChangeAt: null | number;
25
- lastRemoteOrganicChangeAt: null | number;
26
- };
27
- export type TrackSpammingStepsMetadata = {
28
- recentTransactionsTimestemps: Map<string, {
29
- steps: Step[];
30
- timestamp: number;
31
- }>;
32
- };
33
- export type CollabSendableSteps = {
34
- clientID: number | string;
35
- origins: readonly Transaction[];
36
- steps: readonly Step[];
37
- version: number;
38
- };
39
- export type CollabEditPluginSharedState = {
40
- activeParticipants: ReadOnlyParticipants | undefined;
41
- initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
42
- lastReconnectionConflictMetadata: CollabEventConflictPayload | undefined;
43
- sessionId: string | undefined;
44
- };