@atlaskit/editor-plugin-local-id 5.1.6 → 5.1.7

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,13 @@
1
1
  # @atlaskit/editor-plugin-local-id
2
2
 
3
+ ## 5.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d00c391ab0f5a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d00c391ab0f5a) -
8
+ Cleanup a flag making local ids shorter
9
+ - Updated dependencies
10
+
3
11
  ## 5.1.6
4
12
 
5
13
  ### Patch Changes
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.localIdPluginKey = exports.createPlugin = exports.batchAddLocalIdToNodes = exports.addLocalIdToNode = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
- var _adfSchema = require("@atlaskit/adf-schema");
10
9
  var _steps = require("@atlaskit/adf-schema/steps");
11
10
  var _collab = require("@atlaskit/editor-common/collab");
12
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
@@ -20,11 +19,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
20
19
  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; }
21
20
  var localIdPluginKey = exports.localIdPluginKey = new _state.PluginKey('localIdPlugin');
22
21
  var generateUUID = function generateUUID() {
23
- if ((0, _platformFeatureFlags.fg)('platform_editor_ai_local_id_short')) {
24
- return (0, _generateShortUUID.generateShortUUID)();
25
- }
26
- // When the flag is NOT enabled, existing uuid
27
- return _adfSchema.uuid.generate();
22
+ return (0, _generateShortUUID.generateShortUUID)();
28
23
  };
29
24
 
30
25
  // Fallback for Safari which doesn't support requestIdleCallback
@@ -165,12 +160,10 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
165
160
  });
166
161
  if (addedNodes.size > 0 && (0, _platformFeatureFlags.fg)('platform_editor_use_localid_dedupe')) {
167
162
  newState.doc.descendants(function (node) {
163
+ var _node$attrs;
168
164
  // Also track existing UUIDs in the global Set for short UUID collision detection
169
- if ((0, _platformFeatureFlags.fg)('platform_editor_ai_local_id_short')) {
170
- var _node$attrs;
171
- if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId && !hasInitializedExistingUUIDs) {
172
- _generateShortUUID.generatedShortUUIDs.add(node.attrs.localId);
173
- }
165
+ if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId && !hasInitializedExistingUUIDs) {
166
+ _generateShortUUID.generatedShortUUIDs.add(node.attrs.localId);
174
167
  }
175
168
  if (addedNodes.has(node)) {
176
169
  return true;
@@ -186,7 +179,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
186
179
  try {
187
180
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
188
181
  var node = _step.value;
189
- if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId) && (0, _platformFeatureFlags.fg)('platform_editor_ai_local_id_short')) {
182
+ if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId)) {
190
183
  var pos = addedNodePos.get(node);
191
184
  if (pos !== undefined) {
192
185
  if ((0, _platformFeatureFlags.fg)('platform_editor_localid_improvements')) {
@@ -1,4 +1,3 @@
1
- import { uuid } from '@atlaskit/adf-schema';
2
1
  import { BatchAttrsStep } from '@atlaskit/adf-schema/steps';
3
2
  import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
4
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -9,11 +8,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
8
  import { generateShortUUID, generatedShortUUIDs } from './generateShortUUID';
10
9
  export const localIdPluginKey = new PluginKey('localIdPlugin');
11
10
  const generateUUID = () => {
12
- if (fg('platform_editor_ai_local_id_short')) {
13
- return generateShortUUID();
14
- }
15
- // When the flag is NOT enabled, existing uuid
16
- return uuid.generate();
11
+ return generateShortUUID();
17
12
  };
18
13
 
19
14
  // Fallback for Safari which doesn't support requestIdleCallback
@@ -156,12 +151,10 @@ export const createPlugin = api => {
156
151
  });
157
152
  if (addedNodes.size > 0 && fg('platform_editor_use_localid_dedupe')) {
158
153
  newState.doc.descendants(node => {
154
+ var _node$attrs;
159
155
  // Also track existing UUIDs in the global Set for short UUID collision detection
160
- if (fg('platform_editor_ai_local_id_short')) {
161
- var _node$attrs;
162
- if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId && !hasInitializedExistingUUIDs) {
163
- generatedShortUUIDs.add(node.attrs.localId);
164
- }
156
+ if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId && !hasInitializedExistingUUIDs) {
157
+ generatedShortUUIDs.add(node.attrs.localId);
165
158
  }
166
159
  if (addedNodes.has(node)) {
167
160
  return true;
@@ -173,7 +166,7 @@ export const createPlugin = api => {
173
166
  // Also ensure the added have no duplicates
174
167
  const seenIds = new Set();
175
168
  for (const node of addedNodes) {
176
- if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId) && fg('platform_editor_ai_local_id_short')) {
169
+ if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId)) {
177
170
  const pos = addedNodePos.get(node);
178
171
  if (pos !== undefined) {
179
172
  if (fg('platform_editor_localid_improvements')) {
@@ -2,7 +2,6 @@ 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 { uuid } from '@atlaskit/adf-schema';
6
5
  import { BatchAttrsStep } from '@atlaskit/adf-schema/steps';
7
6
  import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
8
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -13,11 +12,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
12
  import { generateShortUUID, generatedShortUUIDs } from './generateShortUUID';
14
13
  export var localIdPluginKey = new PluginKey('localIdPlugin');
15
14
  var generateUUID = function generateUUID() {
16
- if (fg('platform_editor_ai_local_id_short')) {
17
- return generateShortUUID();
18
- }
19
- // When the flag is NOT enabled, existing uuid
20
- return uuid.generate();
15
+ return generateShortUUID();
21
16
  };
22
17
 
23
18
  // Fallback for Safari which doesn't support requestIdleCallback
@@ -158,12 +153,10 @@ export var createPlugin = function createPlugin(api) {
158
153
  });
159
154
  if (addedNodes.size > 0 && fg('platform_editor_use_localid_dedupe')) {
160
155
  newState.doc.descendants(function (node) {
156
+ var _node$attrs;
161
157
  // Also track existing UUIDs in the global Set for short UUID collision detection
162
- if (fg('platform_editor_ai_local_id_short')) {
163
- var _node$attrs;
164
- if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId && !hasInitializedExistingUUIDs) {
165
- generatedShortUUIDs.add(node.attrs.localId);
166
- }
158
+ if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId && !hasInitializedExistingUUIDs) {
159
+ generatedShortUUIDs.add(node.attrs.localId);
167
160
  }
168
161
  if (addedNodes.has(node)) {
169
162
  return true;
@@ -179,7 +172,7 @@ export var createPlugin = function createPlugin(api) {
179
172
  try {
180
173
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
181
174
  var node = _step.value;
182
- if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId) && fg('platform_editor_ai_local_id_short')) {
175
+ if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId)) {
183
176
  var pos = addedNodePos.get(node);
184
177
  if (pos !== undefined) {
185
178
  if (fg('platform_editor_localid_improvements')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-local-id",
3
- "version": "5.1.6",
3
+ "version": "5.1.7",
4
4
  "description": "LocalId plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/editor-plugin-limited-mode": "^4.0.0",
33
33
  "@atlaskit/editor-prosemirror": "^7.3.0",
34
34
  "@atlaskit/platform-feature-flags": "^1.1.0",
35
- "@atlaskit/tmp-editor-statsig": "^22.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^22.2.0",
36
36
  "@babel/runtime": "^7.0.0",
37
37
  "raf-schd": "^4.0.3"
38
38
  },
@@ -83,9 +83,6 @@
83
83
  "platform_editor_use_localid_dedupe": {
84
84
  "type": "boolean"
85
85
  },
86
- "platform_editor_ai_local_id_short": {
87
- "type": "boolean"
88
- },
89
86
  "platform_editor_localid_improvements": {
90
87
  "type": "boolean"
91
88
  },