@atlaskit/editor-plugin-local-id 4.2.7 → 4.3.1

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,20 @@
1
1
  # @atlaskit/editor-plugin-local-id
2
2
 
3
+ ## 4.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`65e23b9169d24`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/65e23b9169d24) -
8
+ Do not pre-load local ids with collab
9
+ - Updated dependencies
10
+
11
+ ## 4.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`8557b67bb48de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8557b67bb48de) -
16
+ Set isDirty to true for dirty transaction
17
+
3
18
  ## 4.2.7
4
19
 
5
20
  ### Patch Changes
@@ -4,7 +4,8 @@
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-local-id",
6
6
  "rootDir": "../",
7
- "composite": true
7
+ "composite": true,
8
+ "noCheck": true
8
9
  },
9
10
  "include": [
10
11
  "../src/**/*.ts",
@@ -4,7 +4,8 @@
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../jira/tsDist/@atlaskit__editor-plugin-local-id/app",
6
6
  "rootDir": "../",
7
- "composite": true
7
+ "composite": true,
8
+ "noCheck": true
8
9
  },
9
10
  "include": [
10
11
  "../src/**/*.ts",
@@ -4,7 +4,8 @@
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../tsDist/@atlaskit__editor-plugin-local-id/app",
6
6
  "rootDir": "../",
7
- "composite": true
7
+ "composite": true,
8
+ "noCheck": true
8
9
  },
9
10
  "include": [
10
11
  "../src/**/*.ts",
@@ -8,6 +8,7 @@ exports.localIdPluginKey = exports.createPlugin = exports.batchAddLocalIdToNodes
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _steps = require("@atlaskit/adf-schema/steps");
11
+ var _collab = require("@atlaskit/editor-common/collab");
11
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
13
  var _utils = require("@atlaskit/editor-common/utils");
13
14
  var _state = require("@atlaskit/editor-prosemirror/state");
@@ -44,6 +45,13 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
44
45
  * to nodes that don't have them. It's designed to run only once per
45
46
  * editor instance to avoid performance issues.
46
47
  */
48
+ // @ts-expect-error - This is an experiment to see if we can improve performance - if successful
49
+ // we will add the plugin as a dependency
50
+ if (api !== null && api !== void 0 && api.collabEdit && (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_avoid_initial_localId')) {
51
+ return {
52
+ update: function update() {}
53
+ };
54
+ }
47
55
  requestIdleCallbackWithFallback(function () {
48
56
  var tr = editorView.state.tr;
49
57
  var localIdWasAdded = false;
@@ -71,10 +79,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
71
79
  if ((0, _platformFeatureFlags.fg)('platform_editor_localid_improvements')) {
72
80
  if (nodesToUpdate.size > 0) {
73
81
  batchAddLocalIdToNodes(nodesToUpdate, tr);
82
+ (0, _collab.tintDirtyTransaction)(tr);
74
83
  editorView.dispatch(tr);
75
84
  }
76
85
  } else if (localIdWasAdded) {
77
86
  tr.setMeta('addToHistory', false);
87
+ (0, _collab.tintDirtyTransaction)(tr);
78
88
  editorView.dispatch(tr);
79
89
  }
80
90
  });
@@ -150,7 +160,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
150
160
  });
151
161
  });
152
162
  if (addedNodes.size > 0 && (0, _platformFeatureFlags.fg)('platform_editor_use_localid_dedupe')) {
153
- newState.doc.descendants(function (node, pos) {
163
+ newState.doc.descendants(function (node) {
154
164
  if (addedNodes.has(node)) {
155
165
  return true;
156
166
  }
@@ -1,5 +1,6 @@
1
1
  import { uuid } from '@atlaskit/adf-schema';
2
2
  import { BatchAttrsStep } from '@atlaskit/adf-schema/steps';
3
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import { stepHasSlice } from '@atlaskit/editor-common/utils';
5
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
@@ -33,6 +34,13 @@ export const createPlugin = api => {
33
34
  * to nodes that don't have them. It's designed to run only once per
34
35
  * editor instance to avoid performance issues.
35
36
  */
37
+ // @ts-expect-error - This is an experiment to see if we can improve performance - if successful
38
+ // we will add the plugin as a dependency
39
+ if (api !== null && api !== void 0 && api.collabEdit && fg('platform_editor_ai_aifc_avoid_initial_localId')) {
40
+ return {
41
+ update: () => {}
42
+ };
43
+ }
36
44
  requestIdleCallbackWithFallback(() => {
37
45
  const tr = editorView.state.tr;
38
46
  let localIdWasAdded = false;
@@ -61,10 +69,12 @@ export const createPlugin = api => {
61
69
  if (fg('platform_editor_localid_improvements')) {
62
70
  if (nodesToUpdate.size > 0) {
63
71
  batchAddLocalIdToNodes(nodesToUpdate, tr);
72
+ tintDirtyTransaction(tr);
64
73
  editorView.dispatch(tr);
65
74
  }
66
75
  } else if (localIdWasAdded) {
67
76
  tr.setMeta('addToHistory', false);
77
+ tintDirtyTransaction(tr);
68
78
  editorView.dispatch(tr);
69
79
  }
70
80
  });
@@ -141,7 +151,7 @@ export const createPlugin = api => {
141
151
  });
142
152
  });
143
153
  if (addedNodes.size > 0 && fg('platform_editor_use_localid_dedupe')) {
144
- newState.doc.descendants((node, pos) => {
154
+ newState.doc.descendants(node => {
145
155
  if (addedNodes.has(node)) {
146
156
  return true;
147
157
  }
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
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
5
  import { uuid } from '@atlaskit/adf-schema';
6
6
  import { BatchAttrsStep } from '@atlaskit/adf-schema/steps';
7
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
7
8
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
9
  import { stepHasSlice } from '@atlaskit/editor-common/utils';
9
10
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
@@ -37,6 +38,13 @@ export var createPlugin = function createPlugin(api) {
37
38
  * to nodes that don't have them. It's designed to run only once per
38
39
  * editor instance to avoid performance issues.
39
40
  */
41
+ // @ts-expect-error - This is an experiment to see if we can improve performance - if successful
42
+ // we will add the plugin as a dependency
43
+ if (api !== null && api !== void 0 && api.collabEdit && fg('platform_editor_ai_aifc_avoid_initial_localId')) {
44
+ return {
45
+ update: function update() {}
46
+ };
47
+ }
40
48
  requestIdleCallbackWithFallback(function () {
41
49
  var tr = editorView.state.tr;
42
50
  var localIdWasAdded = false;
@@ -64,10 +72,12 @@ export var createPlugin = function createPlugin(api) {
64
72
  if (fg('platform_editor_localid_improvements')) {
65
73
  if (nodesToUpdate.size > 0) {
66
74
  batchAddLocalIdToNodes(nodesToUpdate, tr);
75
+ tintDirtyTransaction(tr);
67
76
  editorView.dispatch(tr);
68
77
  }
69
78
  } else if (localIdWasAdded) {
70
79
  tr.setMeta('addToHistory', false);
80
+ tintDirtyTransaction(tr);
71
81
  editorView.dispatch(tr);
72
82
  }
73
83
  });
@@ -143,7 +153,7 @@ export var createPlugin = function createPlugin(api) {
143
153
  });
144
154
  });
145
155
  if (addedNodes.size > 0 && fg('platform_editor_use_localid_dedupe')) {
146
- newState.doc.descendants(function (node, pos) {
156
+ newState.doc.descendants(function (node) {
147
157
  if (addedNodes.has(node)) {
148
158
  return true;
149
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-local-id",
3
- "version": "4.2.7",
3
+ "version": "4.3.1",
4
4
  "description": "LocalId plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "raf-schd": "^4.0.3"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^110.38.0",
38
+ "@atlaskit/editor-common": "^110.41.0",
39
39
  "react": "^18.2.0"
40
40
  },
41
41
  "devDependencies": {
@@ -84,6 +84,9 @@
84
84
  "platform_editor_ai_local_id_short": {
85
85
  "type": "boolean"
86
86
  },
87
+ "platform_editor_ai_aifc_avoid_initial_localId": {
88
+ "type": "boolean"
89
+ },
87
90
  "platform_editor_localid_improvements": {
88
91
  "type": "boolean"
89
92
  }