@atlaskit/editor-plugin-collab-edit 7.1.9 → 7.1.11
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-steps.js +16 -9
- package/dist/cjs/pm-plugins/utils.js +3 -5
- package/dist/es2019/pm-plugins/track-steps.js +7 -1
- package/dist/es2019/pm-plugins/utils.js +2 -6
- package/dist/esm/pm-plugins/track-steps.js +17 -10
- package/dist/esm/pm-plugins/utils.js +3 -5
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 7.1.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`60f37549e619c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/60f37549e619c) -
|
|
8
|
+
Added exclusion list to batchattrs update
|
|
9
|
+
|
|
10
|
+
## 7.1.10
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`750abc612bfa7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/750abc612bfa7) -
|
|
15
|
+
Fixed step analytic reporting
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 7.1.9
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -58,6 +58,13 @@ var sanitizeStep = exports.sanitizeStep = function sanitizeStep(step) {
|
|
|
58
58
|
sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
|
|
59
59
|
} else if (step instanceof _transform.AddMarkStep || step instanceof _transform.RemoveMarkStep || step instanceof _transform.RemoveNodeMarkStep || step instanceof _transform.AddNodeMarkStep) {
|
|
60
60
|
sanitizedStep.markType = step.mark.type.name;
|
|
61
|
+
} else if (step instanceof _steps.BatchAttrsStep) {
|
|
62
|
+
var batched = step.data.map(function (_ref) {
|
|
63
|
+
var nodeType = _ref.nodeType,
|
|
64
|
+
attrs = _ref.attrs;
|
|
65
|
+
return "".concat(nodeType, "_").concat(Object.keys(attrs).sort().join('_'));
|
|
66
|
+
});
|
|
67
|
+
sanitizedStep.attr = batched.sort().join('_');
|
|
61
68
|
}
|
|
62
69
|
return sanitizedStep;
|
|
63
70
|
};
|
|
@@ -84,10 +91,10 @@ var groupSteps = exports.groupSteps = function groupSteps(sanitizedSteps) {
|
|
|
84
91
|
var grouped = groupBy(sanitizedSteps, function (e) {
|
|
85
92
|
return Object.values(e).join('_');
|
|
86
93
|
});
|
|
87
|
-
return Object.entries(grouped).reduce(function (acc,
|
|
88
|
-
var
|
|
89
|
-
key =
|
|
90
|
-
value =
|
|
94
|
+
return Object.entries(grouped).reduce(function (acc, _ref2) {
|
|
95
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
96
|
+
key = _ref3[0],
|
|
97
|
+
value = _ref3[1];
|
|
91
98
|
acc[key] = Array.isArray(value) ? value.length : 0;
|
|
92
99
|
return acc;
|
|
93
100
|
}, {});
|
|
@@ -153,11 +160,11 @@ var getScheduler = function getScheduler(obj) {
|
|
|
153
160
|
* @param {Readonly<Transaction[]>} props.transactions - The transactions that contain the steps.
|
|
154
161
|
* @param {(data: StepMetadataAnalytics[]) => void} props.onTrackDataProcessed - Callback function to be called with the processed data.
|
|
155
162
|
*/
|
|
156
|
-
var track = exports.track = function track(
|
|
157
|
-
var api =
|
|
158
|
-
newEditorState =
|
|
159
|
-
transactions =
|
|
160
|
-
onTrackDataProcessed =
|
|
163
|
+
var track = exports.track = function track(_ref4) {
|
|
164
|
+
var api = _ref4.api,
|
|
165
|
+
newEditorState = _ref4.newEditorState,
|
|
166
|
+
transactions = _ref4.transactions,
|
|
167
|
+
onTrackDataProcessed = _ref4.onTrackDataProcessed;
|
|
161
168
|
var newSteps = transactions.flatMap(function (t) {
|
|
162
169
|
return t.steps;
|
|
163
170
|
});
|
|
@@ -223,8 +223,8 @@ var isOrganicChange = exports.isOrganicChange = function isOrganicChange(tr) {
|
|
|
223
223
|
return Object.keys(data.attrs);
|
|
224
224
|
}).flat();
|
|
225
225
|
return _allAttributes.some(function (attr) {
|
|
226
|
-
return attr
|
|
227
|
-
});
|
|
226
|
+
return !blockedAttrsList.includes(attr);
|
|
227
|
+
}) && !tr.doc.eq(tr.before);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
// If a step is not an instance of SetAttrsStep, it is considered organic
|
|
@@ -236,9 +236,7 @@ var isOrganicChange = exports.isOrganicChange = function isOrganicChange(tr) {
|
|
|
236
236
|
// are not in the `blockedAttributes`. If one of the attributes not on the list, it considers the change
|
|
237
237
|
// organic but only if the entire document is not equal to the previous state.
|
|
238
238
|
return allAttributes.some(function (attr) {
|
|
239
|
-
|
|
240
|
-
return true;
|
|
241
|
-
}
|
|
239
|
+
return !blockedAttrsList.includes(attr);
|
|
242
240
|
}) && !tr.doc.eq(tr.before);
|
|
243
241
|
});
|
|
244
242
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyticsStep, SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { AnalyticsStep, SetAttrsStep, BatchAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
2
2
|
import { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { sendableSteps } from '@atlaskit/prosemirror-collab';
|
|
4
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -47,6 +47,12 @@ export const sanitizeStep = step => {
|
|
|
47
47
|
sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
|
|
48
48
|
} else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep || step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep) {
|
|
49
49
|
sanitizedStep.markType = step.mark.type.name;
|
|
50
|
+
} else if (step instanceof BatchAttrsStep) {
|
|
51
|
+
const batched = step.data.map(({
|
|
52
|
+
nodeType,
|
|
53
|
+
attrs
|
|
54
|
+
}) => `${nodeType}_${Object.keys(attrs).sort().join('_')}`);
|
|
55
|
+
sanitizedStep.attr = batched.sort().join('_');
|
|
50
56
|
}
|
|
51
57
|
return sanitizedStep;
|
|
52
58
|
};
|
|
@@ -208,7 +208,7 @@ export const isOrganicChange = tr => {
|
|
|
208
208
|
// editor-plugin-local-id uses BatchAttrStep to set the localId attribute
|
|
209
209
|
if (step instanceof BatchAttrsStep && fg('platform_editor_inorganic_batchattrsstep_localid')) {
|
|
210
210
|
const allAttributes = step.data.map(data => Object.keys(data.attrs)).flat();
|
|
211
|
-
return allAttributes.some(attr => attr
|
|
211
|
+
return allAttributes.some(attr => !blockedAttrsList.includes(attr)) && !tr.doc.eq(tr.before);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// If a step is not an instance of SetAttrsStep, it is considered organic
|
|
@@ -219,11 +219,7 @@ export const isOrganicChange = tr => {
|
|
|
219
219
|
// If a step is an instance of SetAttrsStep, it checks if the attributes in the step
|
|
220
220
|
// are not in the `blockedAttributes`. If one of the attributes not on the list, it considers the change
|
|
221
221
|
// organic but only if the entire document is not equal to the previous state.
|
|
222
|
-
return allAttributes.some(attr =>
|
|
223
|
-
if (!blockedAttrsList.includes(attr)) {
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
}) && !tr.doc.eq(tr.before);
|
|
222
|
+
return allAttributes.some(attr => !blockedAttrsList.includes(attr)) && !tr.doc.eq(tr.before);
|
|
227
223
|
});
|
|
228
224
|
};
|
|
229
225
|
|
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
4
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
-
import { AnalyticsStep, SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
5
|
+
import { AnalyticsStep, SetAttrsStep, BatchAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
6
6
|
import { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
7
7
|
import { sendableSteps } from '@atlaskit/prosemirror-collab';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -51,6 +51,13 @@ export var sanitizeStep = function sanitizeStep(step) {
|
|
|
51
51
|
sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
|
|
52
52
|
} else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep || step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep) {
|
|
53
53
|
sanitizedStep.markType = step.mark.type.name;
|
|
54
|
+
} else if (step instanceof BatchAttrsStep) {
|
|
55
|
+
var batched = step.data.map(function (_ref) {
|
|
56
|
+
var nodeType = _ref.nodeType,
|
|
57
|
+
attrs = _ref.attrs;
|
|
58
|
+
return "".concat(nodeType, "_").concat(Object.keys(attrs).sort().join('_'));
|
|
59
|
+
});
|
|
60
|
+
sanitizedStep.attr = batched.sort().join('_');
|
|
54
61
|
}
|
|
55
62
|
return sanitizedStep;
|
|
56
63
|
};
|
|
@@ -77,10 +84,10 @@ export var groupSteps = function groupSteps(sanitizedSteps) {
|
|
|
77
84
|
var grouped = groupBy(sanitizedSteps, function (e) {
|
|
78
85
|
return Object.values(e).join('_');
|
|
79
86
|
});
|
|
80
|
-
return Object.entries(grouped).reduce(function (acc,
|
|
81
|
-
var
|
|
82
|
-
key =
|
|
83
|
-
value =
|
|
87
|
+
return Object.entries(grouped).reduce(function (acc, _ref2) {
|
|
88
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
89
|
+
key = _ref3[0],
|
|
90
|
+
value = _ref3[1];
|
|
84
91
|
acc[key] = Array.isArray(value) ? value.length : 0;
|
|
85
92
|
return acc;
|
|
86
93
|
}, {});
|
|
@@ -146,11 +153,11 @@ var getScheduler = function getScheduler(obj) {
|
|
|
146
153
|
* @param {Readonly<Transaction[]>} props.transactions - The transactions that contain the steps.
|
|
147
154
|
* @param {(data: StepMetadataAnalytics[]) => void} props.onTrackDataProcessed - Callback function to be called with the processed data.
|
|
148
155
|
*/
|
|
149
|
-
export var track = function track(
|
|
150
|
-
var api =
|
|
151
|
-
newEditorState =
|
|
152
|
-
transactions =
|
|
153
|
-
onTrackDataProcessed =
|
|
156
|
+
export var track = function track(_ref4) {
|
|
157
|
+
var api = _ref4.api,
|
|
158
|
+
newEditorState = _ref4.newEditorState,
|
|
159
|
+
transactions = _ref4.transactions,
|
|
160
|
+
onTrackDataProcessed = _ref4.onTrackDataProcessed;
|
|
154
161
|
var newSteps = transactions.flatMap(function (t) {
|
|
155
162
|
return t.steps;
|
|
156
163
|
});
|
|
@@ -215,8 +215,8 @@ export var isOrganicChange = function isOrganicChange(tr) {
|
|
|
215
215
|
return Object.keys(data.attrs);
|
|
216
216
|
}).flat();
|
|
217
217
|
return _allAttributes.some(function (attr) {
|
|
218
|
-
return attr
|
|
219
|
-
});
|
|
218
|
+
return !blockedAttrsList.includes(attr);
|
|
219
|
+
}) && !tr.doc.eq(tr.before);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
// If a step is not an instance of SetAttrsStep, it is considered organic
|
|
@@ -228,9 +228,7 @@ export var isOrganicChange = function isOrganicChange(tr) {
|
|
|
228
228
|
// are not in the `blockedAttributes`. If one of the attributes not on the list, it considers the change
|
|
229
229
|
// organic but only if the entire document is not equal to the previous state.
|
|
230
230
|
return allAttributes.some(function (attr) {
|
|
231
|
-
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
231
|
+
return !blockedAttrsList.includes(attr);
|
|
234
232
|
}) && !tr.doc.eq(tr.before);
|
|
235
233
|
});
|
|
236
234
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
2
|
-
import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
|
|
3
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
5
5
|
hideTelecursorOnLoad?: boolean;
|
|
6
6
|
onSyncUpError?: SyncUpErrorFunction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
|
|
2
|
-
import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
|
|
3
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
export type PrivateCollabEditOptions = CollabEditOptions & {
|
|
5
5
|
hideTelecursorOnLoad?: boolean;
|
|
6
6
|
onSyncUpError?: SyncUpErrorFunction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.11",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,29 +27,29 @@
|
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"atlaskit:src": "src/index.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/adf-schema": "^51.5.
|
|
30
|
+
"@atlaskit/adf-schema": "^51.5.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^0.16.0",
|
|
32
32
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
34
34
|
"@atlaskit/editor-plugin-connectivity": "^6.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-feature-flags": "^5.0.0",
|
|
37
|
-
"@atlaskit/editor-prosemirror": "7.
|
|
37
|
+
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
39
39
|
"@atlaskit/frontend-utilities": "^3.2.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
41
41
|
"@atlaskit/prosemirror-collab": "^0.22.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^15.
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^15.11.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"memoize-one": "^6.0.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@atlaskit/editor-common": "^110.
|
|
47
|
+
"@atlaskit/editor-common": "^110.44.0",
|
|
48
48
|
"react": "^18.2.0",
|
|
49
49
|
"react-dom": "^18.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@testing-library/react": "^
|
|
52
|
+
"@testing-library/react": "^16.3.0",
|
|
53
53
|
"wait-for-expect": "^1.2.0"
|
|
54
54
|
},
|
|
55
55
|
"techstack": {
|