@atlaskit/editor-plugin-collab-edit 1.16.0 → 1.17.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#134540](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134540)
8
+ [`46242fbed9aeb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/46242fbed9aeb) -
9
+ Exclude AnalyticsStep, ReplaceStep and ReplaceAround step from filtering
10
+
11
+ ## 1.16.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#134213](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134213)
16
+ [`93bd7032842ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93bd7032842ec) -
17
+ [ux] [ED-24636] Bump ADF Schema package
18
+ - Updated dependencies
19
+
3
20
  ## 1.16.0
4
21
 
5
22
  ### Minor 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
- return tr.steps.map(function (step) {
62
- if (step instanceof _transform.RemoveNodeMarkStep || step instanceof _transform.AddNodeMarkStep || step instanceof _steps.SetAttrsStep || step instanceof _transform.AttrStep || step instanceof _steps.AnalyticsStep) {
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 || step instanceof _transform.ReplaceAroundStep || step instanceof _transform.ReplaceStep) {
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
- }).join('_');
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) {
@@ -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
- return tr.steps.map(step => {
54
- if (step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep || step instanceof SetAttrsStep || step instanceof AttrStep || step instanceof AnalyticsStep) {
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 || step instanceof ReplaceAroundStep || step instanceof ReplaceStep) {
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
- }).join('_');
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 => {
@@ -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
- return tr.steps.map(function (step) {
54
- if (step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep || step instanceof SetAttrsStep || step instanceof AttrStep || step instanceof AnalyticsStep) {
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 || step instanceof ReplaceAroundStep || step instanceof ReplaceStep) {
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
- }).join('_');
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,10 +32,10 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^40.8.1",
35
+ "@atlaskit/adf-schema": "^40.9.0",
36
36
  "@atlaskit/custom-steps": "^0.7.0",
37
- "@atlaskit/editor-common": "^88.2.0",
38
- "@atlaskit/editor-plugin-analytics": "1.8.1",
37
+ "@atlaskit/editor-common": "^88.3.0",
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",
41
41
  "@atlaskit/editor-prosemirror": "5.0.1",