@atlaskit/editor-plugin-collab-edit 1.16.1 → 1.18.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 +15 -0
- package/dist/cjs/pm-plugins/track-and-filter-spamming-steps.js +16 -4
- package/dist/cjs/track-steps.js +2 -1
- package/dist/es2019/pm-plugins/track-and-filter-spamming-steps.js +14 -4
- package/dist/es2019/track-steps.js +2 -1
- package/dist/esm/pm-plugins/track-and-filter-spamming-steps.js +16 -4
- package/dist/esm/track-steps.js +2 -1
- package/dist/types/track-steps.d.ts +1 -0
- package/dist/types-ts4.5/track-steps.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 1.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6035369220646`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6035369220646) -
|
|
8
|
+
Refined logic of sanitizeStep to include stepInstance information
|
|
9
|
+
|
|
10
|
+
## 1.17.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#134540](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134540)
|
|
15
|
+
[`46242fbed9aeb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/46242fbed9aeb) -
|
|
16
|
+
Exclude AnalyticsStep, ReplaceStep and ReplaceAround step from filtering
|
|
17
|
+
|
|
3
18
|
## 1.16.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -22,6 +22,12 @@ var createFilterTransaction = exports.createFilterTransaction = function createF
|
|
|
22
22
|
if (isRemote) {
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
|
+
var containsExcludedSteps = tr.steps.some(function (step) {
|
|
26
|
+
return step instanceof _steps.AnalyticsStep || step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep;
|
|
27
|
+
});
|
|
28
|
+
if (containsExcludedSteps) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
25
31
|
if (tr.docChanged && tr.doc.eq(tr.before)) {
|
|
26
32
|
var transactionKey = generateTransactionKey(tr);
|
|
27
33
|
if (!transactionKey) {
|
|
@@ -58,12 +64,12 @@ var createFilterTransaction = exports.createFilterTransaction = function createF
|
|
|
58
64
|
|
|
59
65
|
// Helper function to create a u ique transaction key
|
|
60
66
|
function generateTransactionKey(tr) {
|
|
61
|
-
|
|
62
|
-
if (step instanceof _transform.RemoveNodeMarkStep || step instanceof _transform.AddNodeMarkStep || step instanceof _steps.SetAttrsStep || step instanceof _transform.AttrStep
|
|
67
|
+
var stepPositions = tr.steps.map(function (step) {
|
|
68
|
+
if (step instanceof _transform.RemoveNodeMarkStep || step instanceof _transform.AddNodeMarkStep || step instanceof _steps.SetAttrsStep || step instanceof _transform.AttrStep) {
|
|
63
69
|
if (step.pos !== undefined) {
|
|
64
70
|
return "".concat(step.pos);
|
|
65
71
|
}
|
|
66
|
-
} else if (step instanceof _transform.AddMarkStep || step instanceof _transform.RemoveMarkStep
|
|
72
|
+
} else if (step instanceof _transform.AddMarkStep || step instanceof _transform.RemoveMarkStep) {
|
|
67
73
|
return "from_".concat(step.from, "_to_").concat(step.to);
|
|
68
74
|
} else if (step instanceof _steps.LinkMetaStep) {
|
|
69
75
|
return "from_".concat(step.toJSON().from, "_to_").concat(step.toJSON().to);
|
|
@@ -71,7 +77,13 @@ function generateTransactionKey(tr) {
|
|
|
71
77
|
return "insertTypeAheadStep";
|
|
72
78
|
}
|
|
73
79
|
return '';
|
|
74
|
-
})
|
|
80
|
+
});
|
|
81
|
+
if (stepPositions.some(function (step) {
|
|
82
|
+
return Boolean(step);
|
|
83
|
+
})) {
|
|
84
|
+
return stepPositions.join('_');
|
|
85
|
+
}
|
|
86
|
+
return '';
|
|
75
87
|
}
|
|
76
88
|
var trackSpammingStepsPluginKey = exports.trackSpammingStepsPluginKey = new _state.PluginKey('trackAndFilterSpammingStepsPluginKey');
|
|
77
89
|
var createPlugin = exports.createPlugin = function createPlugin(trackFilteredTransaction) {
|
package/dist/cjs/track-steps.js
CHANGED
|
@@ -47,7 +47,8 @@ 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
|
|
50
|
+
stepType: serializedStep.stepType,
|
|
51
|
+
stepInstance: step.constructor.name
|
|
51
52
|
};
|
|
52
53
|
if (step instanceof _transform.AttrStep || step instanceof _transform.DocAttrStep) {
|
|
53
54
|
sanitizedStep.attr = step.attr;
|
|
@@ -14,6 +14,12 @@ export const createFilterTransaction = (recentTransactionsTimestamps, trackFilte
|
|
|
14
14
|
if (isRemote) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
|
+
const containsExcludedSteps = tr.steps.some(step => {
|
|
18
|
+
return step instanceof AnalyticsStep || step instanceof ReplaceStep || step instanceof ReplaceAroundStep;
|
|
19
|
+
});
|
|
20
|
+
if (containsExcludedSteps) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
17
23
|
if (tr.docChanged && tr.doc.eq(tr.before)) {
|
|
18
24
|
const transactionKey = generateTransactionKey(tr);
|
|
19
25
|
if (!transactionKey) {
|
|
@@ -50,12 +56,12 @@ export const createFilterTransaction = (recentTransactionsTimestamps, trackFilte
|
|
|
50
56
|
|
|
51
57
|
// Helper function to create a u ique transaction key
|
|
52
58
|
export function generateTransactionKey(tr) {
|
|
53
|
-
|
|
54
|
-
if (step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep || step instanceof SetAttrsStep || step instanceof AttrStep
|
|
59
|
+
const stepPositions = tr.steps.map(step => {
|
|
60
|
+
if (step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep || step instanceof SetAttrsStep || step instanceof AttrStep) {
|
|
55
61
|
if (step.pos !== undefined) {
|
|
56
62
|
return `${step.pos}`;
|
|
57
63
|
}
|
|
58
|
-
} else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep
|
|
64
|
+
} else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep) {
|
|
59
65
|
return `from_${step.from}_to_${step.to}`;
|
|
60
66
|
} else if (step instanceof LinkMetaStep) {
|
|
61
67
|
return `from_${step.toJSON().from}_to_${step.toJSON().to}`;
|
|
@@ -63,7 +69,11 @@ export function generateTransactionKey(tr) {
|
|
|
63
69
|
return `insertTypeAheadStep`;
|
|
64
70
|
}
|
|
65
71
|
return '';
|
|
66
|
-
})
|
|
72
|
+
});
|
|
73
|
+
if (stepPositions.some(step => Boolean(step))) {
|
|
74
|
+
return stepPositions.join('_');
|
|
75
|
+
}
|
|
76
|
+
return '';
|
|
67
77
|
}
|
|
68
78
|
export const trackSpammingStepsPluginKey = new PluginKey('trackAndFilterSpammingStepsPluginKey');
|
|
69
79
|
export const createPlugin = trackFilteredTransaction => {
|
|
@@ -36,7 +36,8 @@ function groupBy(array, keyGetter) {
|
|
|
36
36
|
export const sanitizeStep = step => {
|
|
37
37
|
const serializedStep = step.toJSON();
|
|
38
38
|
const sanitizedStep = {
|
|
39
|
-
stepType: serializedStep.stepType
|
|
39
|
+
stepType: serializedStep.stepType,
|
|
40
|
+
stepInstance: step.constructor.name
|
|
40
41
|
};
|
|
41
42
|
if (step instanceof AttrStep || step instanceof DocAttrStep) {
|
|
42
43
|
sanitizedStep.attr = step.attr;
|
|
@@ -14,6 +14,12 @@ export var createFilterTransaction = function createFilterTransaction(recentTran
|
|
|
14
14
|
if (isRemote) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
|
+
var containsExcludedSteps = tr.steps.some(function (step) {
|
|
18
|
+
return step instanceof AnalyticsStep || step instanceof ReplaceStep || step instanceof ReplaceAroundStep;
|
|
19
|
+
});
|
|
20
|
+
if (containsExcludedSteps) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
17
23
|
if (tr.docChanged && tr.doc.eq(tr.before)) {
|
|
18
24
|
var transactionKey = generateTransactionKey(tr);
|
|
19
25
|
if (!transactionKey) {
|
|
@@ -50,12 +56,12 @@ export var createFilterTransaction = function createFilterTransaction(recentTran
|
|
|
50
56
|
|
|
51
57
|
// Helper function to create a u ique transaction key
|
|
52
58
|
export function generateTransactionKey(tr) {
|
|
53
|
-
|
|
54
|
-
if (step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep || step instanceof SetAttrsStep || step instanceof AttrStep
|
|
59
|
+
var stepPositions = tr.steps.map(function (step) {
|
|
60
|
+
if (step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep || step instanceof SetAttrsStep || step instanceof AttrStep) {
|
|
55
61
|
if (step.pos !== undefined) {
|
|
56
62
|
return "".concat(step.pos);
|
|
57
63
|
}
|
|
58
|
-
} else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep
|
|
64
|
+
} else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep) {
|
|
59
65
|
return "from_".concat(step.from, "_to_").concat(step.to);
|
|
60
66
|
} else if (step instanceof LinkMetaStep) {
|
|
61
67
|
return "from_".concat(step.toJSON().from, "_to_").concat(step.toJSON().to);
|
|
@@ -63,7 +69,13 @@ export function generateTransactionKey(tr) {
|
|
|
63
69
|
return "insertTypeAheadStep";
|
|
64
70
|
}
|
|
65
71
|
return '';
|
|
66
|
-
})
|
|
72
|
+
});
|
|
73
|
+
if (stepPositions.some(function (step) {
|
|
74
|
+
return Boolean(step);
|
|
75
|
+
})) {
|
|
76
|
+
return stepPositions.join('_');
|
|
77
|
+
}
|
|
78
|
+
return '';
|
|
67
79
|
}
|
|
68
80
|
export var trackSpammingStepsPluginKey = new PluginKey('trackAndFilterSpammingStepsPluginKey');
|
|
69
81
|
export var createPlugin = function createPlugin(trackFilteredTransaction) {
|
package/dist/esm/track-steps.js
CHANGED
|
@@ -40,7 +40,8 @@ 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
|
|
43
|
+
stepType: serializedStep.stepType,
|
|
44
|
+
stepInstance: step.constructor.name
|
|
44
45
|
};
|
|
45
46
|
if (step instanceof AttrStep || step instanceof DocAttrStep) {
|
|
46
47
|
sanitizedStep.attr = step.attr;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.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.4.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",
|