@atlaskit/editor-plugin-collab-edit 4.2.1 → 4.2.2
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.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/pm-plugins/utils.js +1 -3
- package/dist/es2019/pm-plugins/utils.js +1 -3
- package/dist/esm/pm-plugins/utils.js +1 -3
- package/dist/types/collabEditPluginType.d.ts +13 -13
- package/dist/types/pm-plugins/events/handlers.d.ts +7 -7
- package/dist/types/pm-plugins/events/initialize.d.ts +4 -4
- package/dist/types/pm-plugins/events/send-transaction.d.ts +3 -3
- package/dist/types/pm-plugins/track-and-filter-spamming-steps.d.ts +3 -3
- package/dist/types/pm-plugins/track-step-metrics.d.ts +2 -2
- package/dist/types/pm-plugins/track-steps.d.ts +5 -5
- package/dist/types/types/index.d.ts +10 -10
- package/dist/types-ts4.5/collabEditPluginType.d.ts +13 -13
- package/dist/types-ts4.5/pm-plugins/events/handlers.d.ts +7 -7
- package/dist/types-ts4.5/pm-plugins/events/initialize.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/events/send-transaction.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/track-and-filter-spamming-steps.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/track-step-metrics.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/track-steps.d.ts +5 -5
- package/dist/types-ts4.5/types/index.d.ts +10 -10
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 4.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
|
|
8
|
+
Sorted type and interface props to improve Atlaskit docs
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 4.2.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -41,8 +41,7 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
41
41
|
if (isSelection) {
|
|
42
42
|
var className = "telepointer color-".concat(color, " telepointer-selection");
|
|
43
43
|
decorations.push(_view.Decoration.inline(from, to, {
|
|
44
|
-
class: className
|
|
45
|
-
'data-initial': initial
|
|
44
|
+
class: className
|
|
46
45
|
}, {
|
|
47
46
|
pointer: {
|
|
48
47
|
sessionId: sessionId,
|
|
@@ -60,7 +59,6 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
|
|
|
60
59
|
cursor.style.cssText = "".concat(style({
|
|
61
60
|
color: avatarColor.backgroundColor
|
|
62
61
|
}), ";");
|
|
63
|
-
cursor.setAttribute('data-initial', initial);
|
|
64
62
|
cursor.setAttribute('aria-label', "".concat(fullName, " cursor position"));
|
|
65
63
|
cursor.setAttribute('role', 'button');
|
|
66
64
|
cursor.setAttribute(_collab.TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
|
|
@@ -27,8 +27,7 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
|
|
|
27
27
|
if (isSelection) {
|
|
28
28
|
const className = `telepointer color-${color} telepointer-selection`;
|
|
29
29
|
decorations.push(Decoration.inline(from, to, {
|
|
30
|
-
class: className
|
|
31
|
-
'data-initial': initial
|
|
30
|
+
class: className
|
|
32
31
|
}, {
|
|
33
32
|
pointer: {
|
|
34
33
|
sessionId,
|
|
@@ -46,7 +45,6 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
|
|
|
46
45
|
cursor.style.cssText = `${style({
|
|
47
46
|
color: avatarColor.backgroundColor
|
|
48
47
|
})};`;
|
|
49
|
-
cursor.setAttribute('data-initial', initial);
|
|
50
48
|
cursor.setAttribute('aria-label', `${fullName} cursor position`);
|
|
51
49
|
cursor.setAttribute('role', 'button');
|
|
52
50
|
cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
|
|
@@ -32,8 +32,7 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
32
32
|
if (isSelection) {
|
|
33
33
|
var className = "telepointer color-".concat(color, " telepointer-selection");
|
|
34
34
|
decorations.push(Decoration.inline(from, to, {
|
|
35
|
-
class: className
|
|
36
|
-
'data-initial': initial
|
|
35
|
+
class: className
|
|
37
36
|
}, {
|
|
38
37
|
pointer: {
|
|
39
38
|
sessionId: sessionId,
|
|
@@ -51,7 +50,6 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
|
|
|
51
50
|
cursor.style.cssText = "".concat(style({
|
|
52
51
|
color: avatarColor.backgroundColor
|
|
53
52
|
}), ";");
|
|
54
|
-
cursor.setAttribute('data-initial', initial);
|
|
55
53
|
cursor.setAttribute('aria-label', "".concat(fullName, " cursor position"));
|
|
56
54
|
cursor.setAttribute('role', 'button');
|
|
57
55
|
cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
|
|
@@ -15,33 +15,33 @@ export type CollabEditPluginDependencies = [
|
|
|
15
15
|
];
|
|
16
16
|
export type CollabEditPluginOptions = PrivateCollabEditOptions;
|
|
17
17
|
export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
18
|
-
pluginConfiguration: CollabEditPluginOptions;
|
|
19
|
-
dependencies: CollabEditPluginDependencies;
|
|
20
|
-
sharedState: CollabEditPluginSharedState;
|
|
21
18
|
actions: {
|
|
22
|
-
getAvatarColor: (str: string) => {
|
|
23
|
-
index: number;
|
|
24
|
-
backgroundColor: string;
|
|
25
|
-
textColor: string;
|
|
26
|
-
};
|
|
27
19
|
addInlineCommentMark: (props: {
|
|
28
20
|
from: number;
|
|
29
|
-
to: number;
|
|
30
21
|
mark: Mark;
|
|
22
|
+
to: number;
|
|
31
23
|
}) => boolean;
|
|
32
24
|
addInlineCommentNodeMark: (props: {
|
|
33
|
-
pos: number;
|
|
34
25
|
mark: Mark;
|
|
26
|
+
pos: number;
|
|
35
27
|
}) => boolean;
|
|
36
|
-
|
|
28
|
+
getAvatarColor: (str: string) => {
|
|
29
|
+
backgroundColor: string;
|
|
30
|
+
index: number;
|
|
31
|
+
textColor: string;
|
|
32
|
+
};
|
|
37
33
|
getCurrentCollabState: () => {
|
|
38
|
-
version: number | undefined;
|
|
39
|
-
sendableSteps: CollabSendableSteps | undefined | null;
|
|
40
34
|
content: JSONNode | undefined;
|
|
35
|
+
sendableSteps: CollabSendableSteps | undefined | null;
|
|
36
|
+
version: number | undefined;
|
|
41
37
|
};
|
|
38
|
+
isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
|
|
42
39
|
validatePMJSONDocument: (doc: any) => boolean;
|
|
43
40
|
};
|
|
44
41
|
commands: {
|
|
45
42
|
nudgeTelepointer: (sessionId: string) => EditorCommand;
|
|
46
43
|
};
|
|
44
|
+
dependencies: CollabEditPluginDependencies;
|
|
45
|
+
pluginConfiguration: CollabEditPluginOptions;
|
|
46
|
+
sharedState: CollabEditPluginSharedState;
|
|
47
47
|
}>;
|
|
@@ -5,21 +5,21 @@ import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { PrivateCollabEditOptions } from '../../types';
|
|
7
7
|
export type SynchronyEntity = {
|
|
8
|
-
on: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
|
|
9
8
|
off: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
|
|
9
|
+
on: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
|
|
10
10
|
};
|
|
11
11
|
export interface CollabHandlers {
|
|
12
|
-
initHandler: (data: CollabEventInitData) => void;
|
|
13
12
|
connectedHandler: (data: CollabEventConnectionData) => void;
|
|
13
|
+
dataConflictHandler: (data: CollabEventConflictPayload) => void;
|
|
14
14
|
dataHandler: (data: CollabEventRemoteData) => void;
|
|
15
|
-
presenceHandler: (data: CollabEventPresenceData) => void;
|
|
16
|
-
telepointerHandler: (data: CollabTelepointerPayload) => void;
|
|
17
|
-
localStepsHandler: (data: CollabEventLocalStepData) => void;
|
|
18
|
-
errorHandler: (error: any) => void;
|
|
19
15
|
entityHandler: ({ entity }: {
|
|
20
16
|
entity: SynchronyEntity;
|
|
21
17
|
}) => void;
|
|
22
|
-
|
|
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
23
|
}
|
|
24
24
|
export type Cleanup = () => void;
|
|
25
25
|
export declare const subscribe: (currentDeps_0: EditorView, currentDeps_1: CollabEditProvider<import("@atlaskit/editor-common/collab").CollabEvents>, currentDeps_2: PrivateCollabEditOptions, currentDeps_3: FeatureFlags, currentDeps_4?: ProviderFactory | undefined, currentDeps_5?: EditorAnalyticsAPI | undefined) => Cleanup;
|
|
@@ -7,12 +7,12 @@ import type { CollabEditPlugin } from '../../collabEditPluginType';
|
|
|
7
7
|
import type { PrivateCollabEditOptions } from '../../types';
|
|
8
8
|
import type { Cleanup } from './handlers';
|
|
9
9
|
type Props = {
|
|
10
|
-
view: EditorView;
|
|
11
|
-
options: PrivateCollabEditOptions;
|
|
12
|
-
providerFactory: ProviderFactory;
|
|
13
|
-
featureFlags: FeatureFlags;
|
|
14
10
|
editorAnalyticsApi: EditorAnalyticsAPI | undefined;
|
|
11
|
+
featureFlags: FeatureFlags;
|
|
12
|
+
options: PrivateCollabEditOptions;
|
|
15
13
|
pluginInjectionApi?: ExtractInjectionAPI<CollabEditPlugin> | undefined;
|
|
14
|
+
providerFactory: ProviderFactory;
|
|
15
|
+
view: EditorView;
|
|
16
16
|
};
|
|
17
17
|
export declare const initialize: ({ options, providerFactory, view, featureFlags, editorAnalyticsApi, pluginInjectionApi, }: Props) => (provider: CollabEditProvider) => Cleanup;
|
|
18
18
|
export {};
|
|
@@ -2,12 +2,12 @@ import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
|
|
|
2
2
|
import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
3
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
type Props = {
|
|
5
|
+
hideTelecursorOnLoad: boolean;
|
|
6
|
+
newEditorState: EditorState;
|
|
7
|
+
oldEditorState: EditorState;
|
|
5
8
|
originalTransaction: Readonly<Transaction>;
|
|
6
9
|
transactions: readonly Transaction[];
|
|
7
|
-
oldEditorState: EditorState;
|
|
8
|
-
newEditorState: EditorState;
|
|
9
10
|
useNativePlugin: boolean;
|
|
10
|
-
hideTelecursorOnLoad: boolean;
|
|
11
11
|
viewMode?: ViewMode;
|
|
12
12
|
};
|
|
13
13
|
export declare const sendTransaction: ({ originalTransaction, transactions, oldEditorState, newEditorState, useNativePlugin, viewMode, hideTelecursorOnLoad, }: Props) => (provider: CollabEditProvider) => void;
|
|
@@ -3,16 +3,16 @@ import { PluginKey, type Transaction } from '@atlaskit/editor-prosemirror/state'
|
|
|
3
3
|
import { type Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import type { TrackSpammingStepsMetadata } from '../types';
|
|
5
5
|
export type RecentTransactionTimestamp = {
|
|
6
|
-
timestamp: number;
|
|
7
6
|
steps: Step[];
|
|
7
|
+
timestamp: number;
|
|
8
8
|
};
|
|
9
9
|
export type RecentTransactionTimestamps = Map<string, RecentTransactionTimestamp>;
|
|
10
10
|
export type TrackFilteredTransaction = (tr: Transaction) => void;
|
|
11
11
|
export type SanitizedFilteredStep = {
|
|
12
|
-
stepType: string;
|
|
13
|
-
stepInstance?: string;
|
|
14
12
|
attr?: string;
|
|
15
13
|
markType?: string;
|
|
14
|
+
stepInstance?: string;
|
|
15
|
+
stepType: string;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Sanitizes a given ProseMirror step by extracting its type and non-UCG relevant attributes.
|
|
@@ -2,10 +2,10 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
2
2
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import type { CollabEditPlugin } from '../collabEditPluginType';
|
|
4
4
|
type StepSessionMetrics = {
|
|
5
|
-
totalStepSize: number;
|
|
6
|
-
numberOfSteps: number;
|
|
7
5
|
maxStepSize: number;
|
|
6
|
+
numberOfSteps: number;
|
|
8
7
|
stepSizeSumForP90: number[];
|
|
8
|
+
totalStepSize: number;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Gets the current step session metrics for a given session ID
|
|
@@ -3,13 +3,13 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
|
|
|
3
3
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import type { CollabEditPlugin } from '../collabEditPluginType';
|
|
5
5
|
export type SanitizedStep = {
|
|
6
|
-
stepType: string;
|
|
7
6
|
attr?: string;
|
|
8
7
|
markType?: string;
|
|
8
|
+
stepType: string;
|
|
9
9
|
};
|
|
10
10
|
export type StepMetadataAnalytics = {
|
|
11
|
-
startedAt: number;
|
|
12
11
|
endedAt: number;
|
|
12
|
+
startedAt: number;
|
|
13
13
|
stepTypesAmount: {
|
|
14
14
|
[key: string]: number;
|
|
15
15
|
};
|
|
@@ -56,15 +56,15 @@ export declare const groupSteps: (sanitizedSteps: SanitizedStep[]) => Record<str
|
|
|
56
56
|
*/
|
|
57
57
|
export declare const task: (cache: CacheType, onTrackDataProcessed: (data: StepMetadataAnalytics[]) => void) => void;
|
|
58
58
|
export type CacheType = Map<number, {
|
|
59
|
-
steps: ReadonlyArray<Step>;
|
|
60
|
-
startedAt: number;
|
|
61
59
|
endedAt: number;
|
|
60
|
+
startedAt: number;
|
|
61
|
+
steps: ReadonlyArray<Step>;
|
|
62
62
|
}>;
|
|
63
63
|
type TrackProps = {
|
|
64
64
|
api: ExtractInjectionAPI<CollabEditPlugin> | undefined;
|
|
65
65
|
newEditorState: EditorState;
|
|
66
|
-
transactions: Readonly<Transaction[]>;
|
|
67
66
|
onTrackDataProcessed: (data: StepMetadataAnalytics[]) => void;
|
|
67
|
+
transactions: Readonly<Transaction[]>;
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
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.
|
|
@@ -2,16 +2,16 @@ import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload,
|
|
|
2
2
|
import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
5
|
-
sanitizePrivateContent?: boolean;
|
|
6
|
-
onSyncUpError?: SyncUpErrorFunction;
|
|
7
5
|
hideTelecursorOnLoad?: boolean;
|
|
6
|
+
onSyncUpError?: SyncUpErrorFunction;
|
|
7
|
+
sanitizePrivateContent?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export type ProviderCallback = <ReturnType>(codeToExecute: (provider: CollabEditProvider) => ReturnType | undefined, onError?: (err: Error) => void) => Promise<ReturnType | undefined> | undefined;
|
|
10
10
|
export type ProviderBuilder = (collabEditProviderPromise: Promise<CollabEditProvider>) => ProviderCallback;
|
|
11
11
|
export interface ReadOnlyParticipants {
|
|
12
|
+
eq: (other: ReadOnlyParticipants) => boolean;
|
|
12
13
|
get: (sessionId: string) => CollabParticipant | undefined;
|
|
13
14
|
toArray: () => ReadonlyArray<CollabParticipant>;
|
|
14
|
-
eq: (other: ReadOnlyParticipants) => boolean;
|
|
15
15
|
}
|
|
16
16
|
export type CollabInitializedMetadata = {
|
|
17
17
|
collabInitialisedAt: null | number;
|
|
@@ -19,26 +19,26 @@ export type CollabInitializedMetadata = {
|
|
|
19
19
|
firstContentBodyChangeAfterInitAt: null | number;
|
|
20
20
|
};
|
|
21
21
|
export type LastOrganicChangeMetadata = {
|
|
22
|
-
lastLocalOrganicChangeAt: null | number;
|
|
23
|
-
lastRemoteOrganicChangeAt: null | number;
|
|
24
22
|
lastLocalOrganicBodyChangeAt: null | number;
|
|
23
|
+
lastLocalOrganicChangeAt: null | number;
|
|
25
24
|
lastRemoteOrganicBodyChangeAt: null | number;
|
|
25
|
+
lastRemoteOrganicChangeAt: null | number;
|
|
26
26
|
};
|
|
27
27
|
export type TrackSpammingStepsMetadata = {
|
|
28
28
|
recentTransactionsTimestemps: Map<string, {
|
|
29
|
-
timestamp: number;
|
|
30
29
|
steps: Step[];
|
|
30
|
+
timestamp: number;
|
|
31
31
|
}>;
|
|
32
32
|
};
|
|
33
33
|
export type CollabSendableSteps = {
|
|
34
|
-
version: number;
|
|
35
|
-
steps: readonly Step[];
|
|
36
34
|
clientID: number | string;
|
|
37
35
|
origins: readonly Transaction[];
|
|
36
|
+
steps: readonly Step[];
|
|
37
|
+
version: number;
|
|
38
38
|
};
|
|
39
39
|
export type CollabEditPluginSharedState = {
|
|
40
|
-
initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
|
|
41
40
|
activeParticipants: ReadOnlyParticipants | undefined;
|
|
42
|
-
|
|
41
|
+
initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
|
|
43
42
|
lastReconnectionConflictMetadata: CollabEventConflictPayload | undefined;
|
|
43
|
+
sessionId: string | undefined;
|
|
44
44
|
};
|
|
@@ -15,33 +15,33 @@ export type CollabEditPluginDependencies = [
|
|
|
15
15
|
];
|
|
16
16
|
export type CollabEditPluginOptions = PrivateCollabEditOptions;
|
|
17
17
|
export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
|
|
18
|
-
pluginConfiguration: CollabEditPluginOptions;
|
|
19
|
-
dependencies: CollabEditPluginDependencies;
|
|
20
|
-
sharedState: CollabEditPluginSharedState;
|
|
21
18
|
actions: {
|
|
22
|
-
getAvatarColor: (str: string) => {
|
|
23
|
-
index: number;
|
|
24
|
-
backgroundColor: string;
|
|
25
|
-
textColor: string;
|
|
26
|
-
};
|
|
27
19
|
addInlineCommentMark: (props: {
|
|
28
20
|
from: number;
|
|
29
|
-
to: number;
|
|
30
21
|
mark: Mark;
|
|
22
|
+
to: number;
|
|
31
23
|
}) => boolean;
|
|
32
24
|
addInlineCommentNodeMark: (props: {
|
|
33
|
-
pos: number;
|
|
34
25
|
mark: Mark;
|
|
26
|
+
pos: number;
|
|
35
27
|
}) => boolean;
|
|
36
|
-
|
|
28
|
+
getAvatarColor: (str: string) => {
|
|
29
|
+
backgroundColor: string;
|
|
30
|
+
index: number;
|
|
31
|
+
textColor: string;
|
|
32
|
+
};
|
|
37
33
|
getCurrentCollabState: () => {
|
|
38
|
-
version: number | undefined;
|
|
39
|
-
sendableSteps: CollabSendableSteps | undefined | null;
|
|
40
34
|
content: JSONNode | undefined;
|
|
35
|
+
sendableSteps: CollabSendableSteps | undefined | null;
|
|
36
|
+
version: number | undefined;
|
|
41
37
|
};
|
|
38
|
+
isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
|
|
42
39
|
validatePMJSONDocument: (doc: any) => boolean;
|
|
43
40
|
};
|
|
44
41
|
commands: {
|
|
45
42
|
nudgeTelepointer: (sessionId: string) => EditorCommand;
|
|
46
43
|
};
|
|
44
|
+
dependencies: CollabEditPluginDependencies;
|
|
45
|
+
pluginConfiguration: CollabEditPluginOptions;
|
|
46
|
+
sharedState: CollabEditPluginSharedState;
|
|
47
47
|
}>;
|
|
@@ -5,21 +5,21 @@ import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { PrivateCollabEditOptions } from '../../types';
|
|
7
7
|
export type SynchronyEntity = {
|
|
8
|
-
on: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
|
|
9
8
|
off: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
|
|
9
|
+
on: (evt: 'disconnected' | 'error', handler: (...args: any) => void) => void;
|
|
10
10
|
};
|
|
11
11
|
export interface CollabHandlers {
|
|
12
|
-
initHandler: (data: CollabEventInitData) => void;
|
|
13
12
|
connectedHandler: (data: CollabEventConnectionData) => void;
|
|
13
|
+
dataConflictHandler: (data: CollabEventConflictPayload) => void;
|
|
14
14
|
dataHandler: (data: CollabEventRemoteData) => void;
|
|
15
|
-
presenceHandler: (data: CollabEventPresenceData) => void;
|
|
16
|
-
telepointerHandler: (data: CollabTelepointerPayload) => void;
|
|
17
|
-
localStepsHandler: (data: CollabEventLocalStepData) => void;
|
|
18
|
-
errorHandler: (error: any) => void;
|
|
19
15
|
entityHandler: ({ entity }: {
|
|
20
16
|
entity: SynchronyEntity;
|
|
21
17
|
}) => void;
|
|
22
|
-
|
|
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
23
|
}
|
|
24
24
|
export type Cleanup = () => void;
|
|
25
25
|
export declare const subscribe: (currentDeps_0: EditorView, currentDeps_1: CollabEditProvider<import("@atlaskit/editor-common/collab").CollabEvents>, currentDeps_2: PrivateCollabEditOptions, currentDeps_3: FeatureFlags, currentDeps_4?: ProviderFactory | undefined, currentDeps_5?: EditorAnalyticsAPI | undefined) => Cleanup;
|
|
@@ -7,12 +7,12 @@ import type { CollabEditPlugin } from '../../collabEditPluginType';
|
|
|
7
7
|
import type { PrivateCollabEditOptions } from '../../types';
|
|
8
8
|
import type { Cleanup } from './handlers';
|
|
9
9
|
type Props = {
|
|
10
|
-
view: EditorView;
|
|
11
|
-
options: PrivateCollabEditOptions;
|
|
12
|
-
providerFactory: ProviderFactory;
|
|
13
|
-
featureFlags: FeatureFlags;
|
|
14
10
|
editorAnalyticsApi: EditorAnalyticsAPI | undefined;
|
|
11
|
+
featureFlags: FeatureFlags;
|
|
12
|
+
options: PrivateCollabEditOptions;
|
|
15
13
|
pluginInjectionApi?: ExtractInjectionAPI<CollabEditPlugin> | undefined;
|
|
14
|
+
providerFactory: ProviderFactory;
|
|
15
|
+
view: EditorView;
|
|
16
16
|
};
|
|
17
17
|
export declare const initialize: ({ options, providerFactory, view, featureFlags, editorAnalyticsApi, pluginInjectionApi, }: Props) => (provider: CollabEditProvider) => Cleanup;
|
|
18
18
|
export {};
|
|
@@ -2,12 +2,12 @@ import type { CollabEditProvider } from '@atlaskit/editor-common/collab';
|
|
|
2
2
|
import type { ViewMode } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
3
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
type Props = {
|
|
5
|
+
hideTelecursorOnLoad: boolean;
|
|
6
|
+
newEditorState: EditorState;
|
|
7
|
+
oldEditorState: EditorState;
|
|
5
8
|
originalTransaction: Readonly<Transaction>;
|
|
6
9
|
transactions: readonly Transaction[];
|
|
7
|
-
oldEditorState: EditorState;
|
|
8
|
-
newEditorState: EditorState;
|
|
9
10
|
useNativePlugin: boolean;
|
|
10
|
-
hideTelecursorOnLoad: boolean;
|
|
11
11
|
viewMode?: ViewMode;
|
|
12
12
|
};
|
|
13
13
|
export declare const sendTransaction: ({ originalTransaction, transactions, oldEditorState, newEditorState, useNativePlugin, viewMode, hideTelecursorOnLoad, }: Props) => (provider: CollabEditProvider) => void;
|
|
@@ -3,16 +3,16 @@ import { PluginKey, type Transaction } from '@atlaskit/editor-prosemirror/state'
|
|
|
3
3
|
import { type Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import type { TrackSpammingStepsMetadata } from '../types';
|
|
5
5
|
export type RecentTransactionTimestamp = {
|
|
6
|
-
timestamp: number;
|
|
7
6
|
steps: Step[];
|
|
7
|
+
timestamp: number;
|
|
8
8
|
};
|
|
9
9
|
export type RecentTransactionTimestamps = Map<string, RecentTransactionTimestamp>;
|
|
10
10
|
export type TrackFilteredTransaction = (tr: Transaction) => void;
|
|
11
11
|
export type SanitizedFilteredStep = {
|
|
12
|
-
stepType: string;
|
|
13
|
-
stepInstance?: string;
|
|
14
12
|
attr?: string;
|
|
15
13
|
markType?: string;
|
|
14
|
+
stepInstance?: string;
|
|
15
|
+
stepType: string;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Sanitizes a given ProseMirror step by extracting its type and non-UCG relevant attributes.
|
|
@@ -2,10 +2,10 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
2
2
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import type { CollabEditPlugin } from '../collabEditPluginType';
|
|
4
4
|
type StepSessionMetrics = {
|
|
5
|
-
totalStepSize: number;
|
|
6
|
-
numberOfSteps: number;
|
|
7
5
|
maxStepSize: number;
|
|
6
|
+
numberOfSteps: number;
|
|
8
7
|
stepSizeSumForP90: number[];
|
|
8
|
+
totalStepSize: number;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Gets the current step session metrics for a given session ID
|
|
@@ -3,13 +3,13 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
|
|
|
3
3
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import type { CollabEditPlugin } from '../collabEditPluginType';
|
|
5
5
|
export type SanitizedStep = {
|
|
6
|
-
stepType: string;
|
|
7
6
|
attr?: string;
|
|
8
7
|
markType?: string;
|
|
8
|
+
stepType: string;
|
|
9
9
|
};
|
|
10
10
|
export type StepMetadataAnalytics = {
|
|
11
|
-
startedAt: number;
|
|
12
11
|
endedAt: number;
|
|
12
|
+
startedAt: number;
|
|
13
13
|
stepTypesAmount: {
|
|
14
14
|
[key: string]: number;
|
|
15
15
|
};
|
|
@@ -56,15 +56,15 @@ export declare const groupSteps: (sanitizedSteps: SanitizedStep[]) => Record<str
|
|
|
56
56
|
*/
|
|
57
57
|
export declare const task: (cache: CacheType, onTrackDataProcessed: (data: StepMetadataAnalytics[]) => void) => void;
|
|
58
58
|
export type CacheType = Map<number, {
|
|
59
|
-
steps: ReadonlyArray<Step>;
|
|
60
|
-
startedAt: number;
|
|
61
59
|
endedAt: number;
|
|
60
|
+
startedAt: number;
|
|
61
|
+
steps: ReadonlyArray<Step>;
|
|
62
62
|
}>;
|
|
63
63
|
type TrackProps = {
|
|
64
64
|
api: ExtractInjectionAPI<CollabEditPlugin> | undefined;
|
|
65
65
|
newEditorState: EditorState;
|
|
66
|
-
transactions: Readonly<Transaction[]>;
|
|
67
66
|
onTrackDataProcessed: (data: StepMetadataAnalytics[]) => void;
|
|
67
|
+
transactions: Readonly<Transaction[]>;
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
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.
|
|
@@ -2,16 +2,16 @@ import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload,
|
|
|
2
2
|
import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
5
|
-
sanitizePrivateContent?: boolean;
|
|
6
|
-
onSyncUpError?: SyncUpErrorFunction;
|
|
7
5
|
hideTelecursorOnLoad?: boolean;
|
|
6
|
+
onSyncUpError?: SyncUpErrorFunction;
|
|
7
|
+
sanitizePrivateContent?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export type ProviderCallback = <ReturnType>(codeToExecute: (provider: CollabEditProvider) => ReturnType | undefined, onError?: (err: Error) => void) => Promise<ReturnType | undefined> | undefined;
|
|
10
10
|
export type ProviderBuilder = (collabEditProviderPromise: Promise<CollabEditProvider>) => ProviderCallback;
|
|
11
11
|
export interface ReadOnlyParticipants {
|
|
12
|
+
eq: (other: ReadOnlyParticipants) => boolean;
|
|
12
13
|
get: (sessionId: string) => CollabParticipant | undefined;
|
|
13
14
|
toArray: () => ReadonlyArray<CollabParticipant>;
|
|
14
|
-
eq: (other: ReadOnlyParticipants) => boolean;
|
|
15
15
|
}
|
|
16
16
|
export type CollabInitializedMetadata = {
|
|
17
17
|
collabInitialisedAt: null | number;
|
|
@@ -19,26 +19,26 @@ export type CollabInitializedMetadata = {
|
|
|
19
19
|
firstContentBodyChangeAfterInitAt: null | number;
|
|
20
20
|
};
|
|
21
21
|
export type LastOrganicChangeMetadata = {
|
|
22
|
-
lastLocalOrganicChangeAt: null | number;
|
|
23
|
-
lastRemoteOrganicChangeAt: null | number;
|
|
24
22
|
lastLocalOrganicBodyChangeAt: null | number;
|
|
23
|
+
lastLocalOrganicChangeAt: null | number;
|
|
25
24
|
lastRemoteOrganicBodyChangeAt: null | number;
|
|
25
|
+
lastRemoteOrganicChangeAt: null | number;
|
|
26
26
|
};
|
|
27
27
|
export type TrackSpammingStepsMetadata = {
|
|
28
28
|
recentTransactionsTimestemps: Map<string, {
|
|
29
|
-
timestamp: number;
|
|
30
29
|
steps: Step[];
|
|
30
|
+
timestamp: number;
|
|
31
31
|
}>;
|
|
32
32
|
};
|
|
33
33
|
export type CollabSendableSteps = {
|
|
34
|
-
version: number;
|
|
35
|
-
steps: readonly Step[];
|
|
36
34
|
clientID: number | string;
|
|
37
35
|
origins: readonly Transaction[];
|
|
36
|
+
steps: readonly Step[];
|
|
37
|
+
version: number;
|
|
38
38
|
};
|
|
39
39
|
export type CollabEditPluginSharedState = {
|
|
40
|
-
initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
|
|
41
40
|
activeParticipants: ReadOnlyParticipants | undefined;
|
|
42
|
-
|
|
41
|
+
initialised: CollabInitializedMetadata & LastOrganicChangeMetadata;
|
|
43
42
|
lastReconnectionConflictMetadata: CollabEventConflictPayload | undefined;
|
|
43
|
+
sessionId: string | undefined;
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@atlaskit/frontend-utilities": "^3.1.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/prosemirror-collab": "^0.17.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^11.5.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"memoize-one": "^6.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^107.
|
|
50
|
+
"@atlaskit/editor-common": "^107.28.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-dom": "^18.2.0"
|
|
53
53
|
},
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
"@atlaskit/ssr": "workspace:^",
|
|
63
63
|
"@atlaskit/synchrony-test-helpers": "workspace:^",
|
|
64
64
|
"@atlaskit/util-data-test": "^18.1.0",
|
|
65
|
-
"@atlaskit/visual-regression": "workspace:^",
|
|
66
65
|
"@testing-library/react": "^13.4.0",
|
|
67
66
|
"wait-for-expect": "^1.2.0"
|
|
68
67
|
},
|