@atlaskit/editor-plugin-collab-edit 1.18.0 → 1.19.0
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 +12 -0
- package/dist/cjs/plugin.js +1 -1
- package/dist/cjs/pm-plugins/track-and-filter-spamming-steps.js +56 -1
- package/dist/cjs/track-steps.js +1 -2
- package/dist/es2019/plugin.js +3 -3
- package/dist/es2019/pm-plugins/track-and-filter-spamming-steps.js +56 -1
- package/dist/es2019/track-steps.js +1 -2
- package/dist/esm/plugin.js +3 -3
- package/dist/esm/pm-plugins/track-and-filter-spamming-steps.js +56 -1
- package/dist/esm/track-steps.js +1 -2
- package/dist/types/pm-plugins/track-and-filter-spamming-steps.d.ts +21 -0
- package/dist/types/track-steps.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/track-and-filter-spamming-steps.d.ts +21 -0
- package/dist/types-ts4.5/track-steps.d.ts +0 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 1.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#132314](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132314)
|
|
8
|
+
[`92f67ece07ca1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/92f67ece07ca1) -
|
|
9
|
+
Refined logic of sanitizeStep to include stepInstance information
|
|
10
|
+
- [#132314](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132314)
|
|
11
|
+
[`92f67ece07ca1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/92f67ece07ca1) -
|
|
12
|
+
Improve implementation of serializeStep to include stepInstance namefor more detailed analytics
|
|
13
|
+
log.
|
|
14
|
+
|
|
3
15
|
## 1.18.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -181,7 +181,7 @@ var collabEditPlugin = exports.collabEditPlugin = function collabEditPlugin(_ref
|
|
|
181
181
|
return (0, _trackAndFilterSpammingSteps.createPlugin)(function (tr) {
|
|
182
182
|
var _api$analytics;
|
|
183
183
|
var sanitizedSteps = tr.steps.map(function (step) {
|
|
184
|
-
return (0,
|
|
184
|
+
return (0, _trackAndFilterSpammingSteps.sanitizeFilteredStep)(step);
|
|
185
185
|
});
|
|
186
186
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
|
|
187
187
|
action: _analytics.ACTION.STEPS_FILTERED,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createPlugin = exports.createFilterTransaction = void 0;
|
|
7
7
|
exports.generateTransactionKey = generateTransactionKey;
|
|
8
|
-
exports.trackSpammingStepsPluginKey = void 0;
|
|
8
|
+
exports.trackSpammingStepsPluginKey = exports.sanitizeFilteredStep = void 0;
|
|
9
9
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -13,6 +13,61 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
14
|
var THRESHOLD = 50; // 50 milliseconds
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Sanitizes a given ProseMirror step by extracting its type and non-UCG relevant attributes.
|
|
18
|
+
*
|
|
19
|
+
* @param {Step} step - The ProseMirror step to be sanitized.
|
|
20
|
+
* @returns {SanitizedFilteredStep} - The sanitized step with only necessary information.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* const step = new AttrStep(10, 'colwidth', [123, 451] );
|
|
25
|
+
* const sanitized = sanitizeFilteredStep(step);
|
|
26
|
+
*
|
|
27
|
+
* // Output: { stepType: 'attr', stepInstance: 'AttrStep', attr: 'example' }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
var sanitizeFilteredStep = exports.sanitizeFilteredStep = function sanitizeFilteredStep(step) {
|
|
31
|
+
var serializedStep = step.toJSON();
|
|
32
|
+
var sanitizedStep = {
|
|
33
|
+
stepType: serializedStep.stepType,
|
|
34
|
+
stepInstance: 'unknown'
|
|
35
|
+
};
|
|
36
|
+
if (step instanceof _transform.AttrStep) {
|
|
37
|
+
sanitizedStep.attr = step.attr;
|
|
38
|
+
sanitizedStep.stepInstance = 'AttrStep';
|
|
39
|
+
} else if (step instanceof _transform.DocAttrStep) {
|
|
40
|
+
sanitizedStep.attr = step.attr;
|
|
41
|
+
sanitizedStep.stepInstance = 'DocAttrStep';
|
|
42
|
+
} else if (step instanceof _steps.SetAttrsStep) {
|
|
43
|
+
// Combines all attrs keys separated by _ to one single string
|
|
44
|
+
sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
|
|
45
|
+
sanitizedStep.stepInstance = 'SetAttrsStep';
|
|
46
|
+
} else if (step instanceof _transform.AddMarkStep) {
|
|
47
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
48
|
+
sanitizedStep.stepInstance = 'AddMarkStep';
|
|
49
|
+
} else if (step instanceof _transform.RemoveMarkStep) {
|
|
50
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
51
|
+
sanitizedStep.stepInstance = 'RemoveMarkStep';
|
|
52
|
+
} else if (step instanceof _transform.RemoveNodeMarkStep) {
|
|
53
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
54
|
+
sanitizedStep.stepInstance = 'RemoveNodeMarkStep';
|
|
55
|
+
} else if (step instanceof _transform.AddNodeMarkStep) {
|
|
56
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
57
|
+
sanitizedStep.stepInstance = 'AddNodeMarkStep';
|
|
58
|
+
} else if (step instanceof _transform.ReplaceStep) {
|
|
59
|
+
sanitizedStep.stepInstance = 'ReplaceStep';
|
|
60
|
+
} else if (step instanceof _transform.ReplaceAroundStep) {
|
|
61
|
+
sanitizedStep.stepInstance = 'ReplaceAroundStep';
|
|
62
|
+
} else if (step instanceof _steps.AnalyticsStep) {
|
|
63
|
+
sanitizedStep.stepInstance = 'AnalyticsStep';
|
|
64
|
+
} else if (step instanceof _steps.InsertTypeAheadStep) {
|
|
65
|
+
sanitizedStep.stepInstance = 'InsertTypeAheadStep';
|
|
66
|
+
} else if (step instanceof _steps.LinkMetaStep) {
|
|
67
|
+
sanitizedStep.stepInstance = 'LinkMetaStep';
|
|
68
|
+
}
|
|
69
|
+
return sanitizedStep;
|
|
70
|
+
};
|
|
16
71
|
var createFilterTransaction = exports.createFilterTransaction = function createFilterTransaction(recentTransactionsTimestamps, trackFilteredTransaction) {
|
|
17
72
|
return function (tr) {
|
|
18
73
|
if (Boolean(tr.getMeta('appendTransaction'))) {
|
package/dist/cjs/track-steps.js
CHANGED
|
@@ -47,8 +47,7 @@ function groupBy(array, keyGetter) {
|
|
|
47
47
|
var sanitizeStep = exports.sanitizeStep = function sanitizeStep(step) {
|
|
48
48
|
var serializedStep = step.toJSON();
|
|
49
49
|
var sanitizedStep = {
|
|
50
|
-
stepType: serializedStep.stepType
|
|
51
|
-
stepInstance: step.constructor.name
|
|
50
|
+
stepType: serializedStep.stepType
|
|
52
51
|
};
|
|
53
52
|
if (step instanceof _transform.AttrStep || step instanceof _transform.DocAttrStep) {
|
|
54
53
|
sanitizedStep.attr = step.attr;
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -7,10 +7,10 @@ import { sendTransaction } from './events/send-transaction';
|
|
|
7
7
|
import { createPlugin } from './pm-plugins/main';
|
|
8
8
|
import { pluginKey as mainPluginKey } from './pm-plugins/main/plugin-key';
|
|
9
9
|
import { nativeCollabProviderPlugin } from './pm-plugins/native-collab-provider-plugin';
|
|
10
|
-
import { createPlugin as trackSpammingStepsPlugin } from './pm-plugins/track-and-filter-spamming-steps';
|
|
10
|
+
import { sanitizeFilteredStep, createPlugin as trackSpammingStepsPlugin } from './pm-plugins/track-and-filter-spamming-steps';
|
|
11
11
|
import { createPlugin as createLastOrganicChangePlugin, trackLastOrganicChangePluginKey } from './pm-plugins/track-last-organic-change';
|
|
12
12
|
import { createPlugin as createTrackNCSInitializationPlugin, trackNCSInitializationPluginKey } from './pm-plugins/track-ncs-initialization';
|
|
13
|
-
import {
|
|
13
|
+
import { track } from './track-steps';
|
|
14
14
|
import { getAvatarColor } from './utils';
|
|
15
15
|
const providerBuilder = collabEditProviderPromise => async (codeToExecute, onError) => {
|
|
16
16
|
try {
|
|
@@ -134,7 +134,7 @@ export const collabEditPlugin = ({
|
|
|
134
134
|
name: 'trackAndFilterSpammingSteps',
|
|
135
135
|
plugin: () => trackSpammingStepsPlugin(tr => {
|
|
136
136
|
var _api$analytics, _api$analytics$action;
|
|
137
|
-
const sanitizedSteps = tr.steps.map(step =>
|
|
137
|
+
const sanitizedSteps = tr.steps.map(step => sanitizeFilteredStep(step));
|
|
138
138
|
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.fireAnalyticsEvent({
|
|
139
139
|
action: ACTION.STEPS_FILTERED,
|
|
140
140
|
actionSubject: ACTION_SUBJECT.COLLAB,
|
|
@@ -1,10 +1,65 @@
|
|
|
1
1
|
import { AnalyticsStep, InsertTypeAheadStep, LinkMetaStep, SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { AddMarkStep, AddNodeMarkStep, AttrStep, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
const THRESHOLD = 50; // 50 milliseconds
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Sanitizes a given ProseMirror step by extracting its type and non-UCG relevant attributes.
|
|
10
|
+
*
|
|
11
|
+
* @param {Step} step - The ProseMirror step to be sanitized.
|
|
12
|
+
* @returns {SanitizedFilteredStep} - The sanitized step with only necessary information.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```
|
|
16
|
+
* const step = new AttrStep(10, 'colwidth', [123, 451] );
|
|
17
|
+
* const sanitized = sanitizeFilteredStep(step);
|
|
18
|
+
*
|
|
19
|
+
* // Output: { stepType: 'attr', stepInstance: 'AttrStep', attr: 'example' }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const sanitizeFilteredStep = step => {
|
|
23
|
+
const serializedStep = step.toJSON();
|
|
24
|
+
const sanitizedStep = {
|
|
25
|
+
stepType: serializedStep.stepType,
|
|
26
|
+
stepInstance: 'unknown'
|
|
27
|
+
};
|
|
28
|
+
if (step instanceof AttrStep) {
|
|
29
|
+
sanitizedStep.attr = step.attr;
|
|
30
|
+
sanitizedStep.stepInstance = 'AttrStep';
|
|
31
|
+
} else if (step instanceof DocAttrStep) {
|
|
32
|
+
sanitizedStep.attr = step.attr;
|
|
33
|
+
sanitizedStep.stepInstance = 'DocAttrStep';
|
|
34
|
+
} else if (step instanceof SetAttrsStep) {
|
|
35
|
+
// Combines all attrs keys separated by _ to one single string
|
|
36
|
+
sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
|
|
37
|
+
sanitizedStep.stepInstance = 'SetAttrsStep';
|
|
38
|
+
} else if (step instanceof AddMarkStep) {
|
|
39
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
40
|
+
sanitizedStep.stepInstance = 'AddMarkStep';
|
|
41
|
+
} else if (step instanceof RemoveMarkStep) {
|
|
42
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
43
|
+
sanitizedStep.stepInstance = 'RemoveMarkStep';
|
|
44
|
+
} else if (step instanceof RemoveNodeMarkStep) {
|
|
45
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
46
|
+
sanitizedStep.stepInstance = 'RemoveNodeMarkStep';
|
|
47
|
+
} else if (step instanceof AddNodeMarkStep) {
|
|
48
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
49
|
+
sanitizedStep.stepInstance = 'AddNodeMarkStep';
|
|
50
|
+
} else if (step instanceof ReplaceStep) {
|
|
51
|
+
sanitizedStep.stepInstance = 'ReplaceStep';
|
|
52
|
+
} else if (step instanceof ReplaceAroundStep) {
|
|
53
|
+
sanitizedStep.stepInstance = 'ReplaceAroundStep';
|
|
54
|
+
} else if (step instanceof AnalyticsStep) {
|
|
55
|
+
sanitizedStep.stepInstance = 'AnalyticsStep';
|
|
56
|
+
} else if (step instanceof InsertTypeAheadStep) {
|
|
57
|
+
sanitizedStep.stepInstance = 'InsertTypeAheadStep';
|
|
58
|
+
} else if (step instanceof LinkMetaStep) {
|
|
59
|
+
sanitizedStep.stepInstance = 'LinkMetaStep';
|
|
60
|
+
}
|
|
61
|
+
return sanitizedStep;
|
|
62
|
+
};
|
|
8
63
|
export const createFilterTransaction = (recentTransactionsTimestamps, trackFilteredTransaction) => {
|
|
9
64
|
return tr => {
|
|
10
65
|
if (Boolean(tr.getMeta('appendTransaction'))) {
|
|
@@ -36,8 +36,7 @@ function groupBy(array, keyGetter) {
|
|
|
36
36
|
export const sanitizeStep = step => {
|
|
37
37
|
const serializedStep = step.toJSON();
|
|
38
38
|
const sanitizedStep = {
|
|
39
|
-
stepType: serializedStep.stepType
|
|
40
|
-
stepInstance: step.constructor.name
|
|
39
|
+
stepType: serializedStep.stepType
|
|
41
40
|
};
|
|
42
41
|
if (step instanceof AttrStep || step instanceof DocAttrStep) {
|
|
43
42
|
sanitizedStep.attr = step.attr;
|
package/dist/esm/plugin.js
CHANGED
|
@@ -13,10 +13,10 @@ import { sendTransaction } from './events/send-transaction';
|
|
|
13
13
|
import { createPlugin } from './pm-plugins/main';
|
|
14
14
|
import { pluginKey as mainPluginKey } from './pm-plugins/main/plugin-key';
|
|
15
15
|
import { nativeCollabProviderPlugin } from './pm-plugins/native-collab-provider-plugin';
|
|
16
|
-
import { createPlugin as trackSpammingStepsPlugin } from './pm-plugins/track-and-filter-spamming-steps';
|
|
16
|
+
import { sanitizeFilteredStep, createPlugin as trackSpammingStepsPlugin } from './pm-plugins/track-and-filter-spamming-steps';
|
|
17
17
|
import { createPlugin as createLastOrganicChangePlugin, trackLastOrganicChangePluginKey } from './pm-plugins/track-last-organic-change';
|
|
18
18
|
import { createPlugin as createTrackNCSInitializationPlugin, trackNCSInitializationPluginKey } from './pm-plugins/track-ncs-initialization';
|
|
19
|
-
import {
|
|
19
|
+
import { track } from './track-steps';
|
|
20
20
|
import { getAvatarColor } from './utils';
|
|
21
21
|
var providerBuilder = function providerBuilder(collabEditProviderPromise) {
|
|
22
22
|
return /*#__PURE__*/function () {
|
|
@@ -174,7 +174,7 @@ export var collabEditPlugin = function collabEditPlugin(_ref4) {
|
|
|
174
174
|
return trackSpammingStepsPlugin(function (tr) {
|
|
175
175
|
var _api$analytics;
|
|
176
176
|
var sanitizedSteps = tr.steps.map(function (step) {
|
|
177
|
-
return
|
|
177
|
+
return sanitizeFilteredStep(step);
|
|
178
178
|
});
|
|
179
179
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
|
|
180
180
|
action: ACTION.STEPS_FILTERED,
|
|
@@ -1,10 +1,65 @@
|
|
|
1
1
|
import { AnalyticsStep, InsertTypeAheadStep, LinkMetaStep, SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { AddMarkStep, AddNodeMarkStep, AttrStep, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
var THRESHOLD = 50; // 50 milliseconds
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Sanitizes a given ProseMirror step by extracting its type and non-UCG relevant attributes.
|
|
10
|
+
*
|
|
11
|
+
* @param {Step} step - The ProseMirror step to be sanitized.
|
|
12
|
+
* @returns {SanitizedFilteredStep} - The sanitized step with only necessary information.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```
|
|
16
|
+
* const step = new AttrStep(10, 'colwidth', [123, 451] );
|
|
17
|
+
* const sanitized = sanitizeFilteredStep(step);
|
|
18
|
+
*
|
|
19
|
+
* // Output: { stepType: 'attr', stepInstance: 'AttrStep', attr: 'example' }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export var sanitizeFilteredStep = function sanitizeFilteredStep(step) {
|
|
23
|
+
var serializedStep = step.toJSON();
|
|
24
|
+
var sanitizedStep = {
|
|
25
|
+
stepType: serializedStep.stepType,
|
|
26
|
+
stepInstance: 'unknown'
|
|
27
|
+
};
|
|
28
|
+
if (step instanceof AttrStep) {
|
|
29
|
+
sanitizedStep.attr = step.attr;
|
|
30
|
+
sanitizedStep.stepInstance = 'AttrStep';
|
|
31
|
+
} else if (step instanceof DocAttrStep) {
|
|
32
|
+
sanitizedStep.attr = step.attr;
|
|
33
|
+
sanitizedStep.stepInstance = 'DocAttrStep';
|
|
34
|
+
} else if (step instanceof SetAttrsStep) {
|
|
35
|
+
// Combines all attrs keys separated by _ to one single string
|
|
36
|
+
sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
|
|
37
|
+
sanitizedStep.stepInstance = 'SetAttrsStep';
|
|
38
|
+
} else if (step instanceof AddMarkStep) {
|
|
39
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
40
|
+
sanitizedStep.stepInstance = 'AddMarkStep';
|
|
41
|
+
} else if (step instanceof RemoveMarkStep) {
|
|
42
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
43
|
+
sanitizedStep.stepInstance = 'RemoveMarkStep';
|
|
44
|
+
} else if (step instanceof RemoveNodeMarkStep) {
|
|
45
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
46
|
+
sanitizedStep.stepInstance = 'RemoveNodeMarkStep';
|
|
47
|
+
} else if (step instanceof AddNodeMarkStep) {
|
|
48
|
+
sanitizedStep.markType = step.mark.type.name;
|
|
49
|
+
sanitizedStep.stepInstance = 'AddNodeMarkStep';
|
|
50
|
+
} else if (step instanceof ReplaceStep) {
|
|
51
|
+
sanitizedStep.stepInstance = 'ReplaceStep';
|
|
52
|
+
} else if (step instanceof ReplaceAroundStep) {
|
|
53
|
+
sanitizedStep.stepInstance = 'ReplaceAroundStep';
|
|
54
|
+
} else if (step instanceof AnalyticsStep) {
|
|
55
|
+
sanitizedStep.stepInstance = 'AnalyticsStep';
|
|
56
|
+
} else if (step instanceof InsertTypeAheadStep) {
|
|
57
|
+
sanitizedStep.stepInstance = 'InsertTypeAheadStep';
|
|
58
|
+
} else if (step instanceof LinkMetaStep) {
|
|
59
|
+
sanitizedStep.stepInstance = 'LinkMetaStep';
|
|
60
|
+
}
|
|
61
|
+
return sanitizedStep;
|
|
62
|
+
};
|
|
8
63
|
export var createFilterTransaction = function createFilterTransaction(recentTransactionsTimestamps, trackFilteredTransaction) {
|
|
9
64
|
return function (tr) {
|
|
10
65
|
if (Boolean(tr.getMeta('appendTransaction'))) {
|
package/dist/esm/track-steps.js
CHANGED
|
@@ -40,8 +40,7 @@ function groupBy(array, keyGetter) {
|
|
|
40
40
|
export var sanitizeStep = function sanitizeStep(step) {
|
|
41
41
|
var serializedStep = step.toJSON();
|
|
42
42
|
var sanitizedStep = {
|
|
43
|
-
stepType: serializedStep.stepType
|
|
44
|
-
stepInstance: step.constructor.name
|
|
43
|
+
stepType: serializedStep.stepType
|
|
45
44
|
};
|
|
46
45
|
if (step instanceof AttrStep || step instanceof DocAttrStep) {
|
|
47
46
|
sanitizedStep.attr = step.attr;
|
|
@@ -8,6 +8,27 @@ export type RecentTransactionTimestamp = {
|
|
|
8
8
|
};
|
|
9
9
|
export type RecentTransactionTimestamps = Map<string, RecentTransactionTimestamp>;
|
|
10
10
|
export type TrackFilteredTransaction = (tr: Transaction) => void;
|
|
11
|
+
export type SanitizedFilteredStep = {
|
|
12
|
+
stepType: string;
|
|
13
|
+
stepInstance?: string;
|
|
14
|
+
attr?: string;
|
|
15
|
+
markType?: string;
|
|
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 {SanitizedFilteredStep} - The sanitized step with only necessary information.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```
|
|
25
|
+
* const step = new AttrStep(10, 'colwidth', [123, 451] );
|
|
26
|
+
* const sanitized = sanitizeFilteredStep(step);
|
|
27
|
+
*
|
|
28
|
+
* // Output: { stepType: 'attr', stepInstance: 'AttrStep', attr: 'example' }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const sanitizeFilteredStep: (step: Step) => SanitizedFilteredStep;
|
|
11
32
|
export declare const createFilterTransaction: (recentTransactionsTimestamps: RecentTransactionTimestamps, trackFilteredTransaction: TrackFilteredTransaction) => (tr: Transaction) => boolean;
|
|
12
33
|
export declare function generateTransactionKey(tr: Transaction): string;
|
|
13
34
|
export declare const trackSpammingStepsPluginKey: PluginKey<TrackSpammingStepsMetadata>;
|
|
@@ -8,6 +8,27 @@ export type RecentTransactionTimestamp = {
|
|
|
8
8
|
};
|
|
9
9
|
export type RecentTransactionTimestamps = Map<string, RecentTransactionTimestamp>;
|
|
10
10
|
export type TrackFilteredTransaction = (tr: Transaction) => void;
|
|
11
|
+
export type SanitizedFilteredStep = {
|
|
12
|
+
stepType: string;
|
|
13
|
+
stepInstance?: string;
|
|
14
|
+
attr?: string;
|
|
15
|
+
markType?: string;
|
|
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 {SanitizedFilteredStep} - The sanitized step with only necessary information.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```
|
|
25
|
+
* const step = new AttrStep(10, 'colwidth', [123, 451] );
|
|
26
|
+
* const sanitized = sanitizeFilteredStep(step);
|
|
27
|
+
*
|
|
28
|
+
* // Output: { stepType: 'attr', stepInstance: 'AttrStep', attr: 'example' }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const sanitizeFilteredStep: (step: Step) => SanitizedFilteredStep;
|
|
11
32
|
export declare const createFilterTransaction: (recentTransactionsTimestamps: RecentTransactionTimestamps, trackFilteredTransaction: TrackFilteredTransaction) => (tr: Transaction) => boolean;
|
|
12
33
|
export declare function generateTransactionKey(tr: Transaction): string;
|
|
13
34
|
export declare const trackSpammingStepsPluginKey: PluginKey<TrackSpammingStepsMetadata>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
36
36
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
37
|
-
"@atlaskit/editor-common": "^88.
|
|
37
|
+
"@atlaskit/editor-common": "^88.5.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "1.8.2",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|