@atlaskit/editor-plugin-local-id 12.0.3 → 12.0.4
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 +8 -0
- package/dist/cjs/pm-plugins/main.js +57 -90
- package/dist/es2019/pm-plugins/main.js +30 -54
- package/dist/esm/pm-plugins/main.js +57 -90
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-local-id
|
|
2
2
|
|
|
3
|
+
## 12.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`dc25bddeafe4d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dc25bddeafe4d) -
|
|
8
|
+
Clean up experiment `platform_editor_ai_tablecell_localids`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 12.0.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -96,10 +96,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
96
96
|
var addedNodes = new Set();
|
|
97
97
|
// A single PMNode reference can appear at multiple positions in the doc (e.g.
|
|
98
98
|
// `createTable` from `prosemirror-utils` reuses cell node objects across
|
|
99
|
-
// non-header rows), so
|
|
100
|
-
// The legacy path retains the single-position-per-node map for compatibility.
|
|
99
|
+
// non-header rows), so we track every position per node identity.
|
|
101
100
|
var positionsByNode = new Map();
|
|
102
|
-
var addedNodePos = new Map();
|
|
103
101
|
var localIds = new Set();
|
|
104
102
|
var nodesToUpdate = new Map(); // position -> localId
|
|
105
103
|
|
|
@@ -150,7 +148,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
150
148
|
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
151
149
|
// Scan the changed range to find all nodes
|
|
152
150
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
|
|
153
|
-
var _node$type$spec$attrs2;
|
|
151
|
+
var _node$type$spec$attrs2, _positionsByNode$get;
|
|
154
152
|
if (ignoredNodeTypes.includes(node.type.name) || !((_node$type$spec$attrs2 = node.type.spec.attrs) !== null && _node$type$spec$attrs2 !== void 0 && _node$type$spec$attrs2.localId)) {
|
|
155
153
|
return true;
|
|
156
154
|
}
|
|
@@ -158,14 +156,9 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
158
156
|
|
|
159
157
|
// Always add to addedNodes for duplicate prevention
|
|
160
158
|
addedNodes.add(node);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
positions.add(pos);
|
|
165
|
-
positionsByNode.set(node, positions);
|
|
166
|
-
} else {
|
|
167
|
-
addedNodePos.set(node, pos);
|
|
168
|
-
}
|
|
159
|
+
var positions = (_positionsByNode$get = positionsByNode.get(node)) !== null && _positionsByNode$get !== void 0 ? _positionsByNode$get : new Set();
|
|
160
|
+
positions.add(pos);
|
|
161
|
+
positionsByNode.set(node, positions);
|
|
169
162
|
return true;
|
|
170
163
|
});
|
|
171
164
|
});
|
|
@@ -187,91 +180,65 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
187
180
|
hasInitializedExistingUUIDs = true;
|
|
188
181
|
// Also ensure the added have no duplicates
|
|
189
182
|
var seenIds = new Set();
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
var existingId = node.attrs.localId;
|
|
201
|
-
var needsNewIds = !existingId || localIds.has(existingId) || seenIds.has(existingId);
|
|
202
|
-
if (needsNewIds) {
|
|
203
|
-
// No usable localId: assign a fresh unique one to every position.
|
|
204
|
-
var _iterator2 = _createForOfIteratorHelper(positions),
|
|
205
|
-
_step2;
|
|
206
|
-
try {
|
|
207
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
208
|
-
var pos = _step2.value;
|
|
209
|
-
var newId = generateUUID();
|
|
210
|
-
nodesToUpdate.set(pos, newId);
|
|
211
|
-
seenIds.add(newId);
|
|
212
|
-
modified = true;
|
|
213
|
-
}
|
|
214
|
-
} catch (err) {
|
|
215
|
-
_iterator2.e(err);
|
|
216
|
-
} finally {
|
|
217
|
-
_iterator2.f();
|
|
218
|
-
}
|
|
219
|
-
} else if (positions.size > 1) {
|
|
220
|
-
// Shared node reference: keep the existing id at the first position,
|
|
221
|
-
// assign fresh ones to the rest so they don't share the same localId.
|
|
222
|
-
seenIds.add(existingId);
|
|
223
|
-
var _Array$from = Array.from(positions),
|
|
224
|
-
_Array$from2 = (0, _toArray2.default)(_Array$from),
|
|
225
|
-
_first = _Array$from2[0],
|
|
226
|
-
rest = _arrayLikeToArray(_Array$from2).slice(1);
|
|
227
|
-
var _iterator3 = _createForOfIteratorHelper(rest),
|
|
228
|
-
_step3;
|
|
229
|
-
try {
|
|
230
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
231
|
-
var _pos = _step3.value;
|
|
232
|
-
var _newId = generateUUID();
|
|
233
|
-
nodesToUpdate.set(_pos, _newId);
|
|
234
|
-
seenIds.add(_newId);
|
|
235
|
-
modified = true;
|
|
236
|
-
}
|
|
237
|
-
} catch (err) {
|
|
238
|
-
_iterator3.e(err);
|
|
239
|
-
} finally {
|
|
240
|
-
_iterator3.f();
|
|
241
|
-
}
|
|
242
|
-
} else if (existingId) {
|
|
243
|
-
seenIds.add(existingId);
|
|
244
|
-
}
|
|
183
|
+
var _iterator = _createForOfIteratorHelper(addedNodes),
|
|
184
|
+
_step;
|
|
185
|
+
try {
|
|
186
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
187
|
+
var node = _step.value;
|
|
188
|
+
var positions = positionsByNode.get(node);
|
|
189
|
+
if (!positions || positions.size === 0) {
|
|
190
|
+
continue;
|
|
245
191
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
var _pos2 = addedNodePos.get(_node);
|
|
259
|
-
if (_pos2 !== undefined) {
|
|
260
|
-
var _newId2 = generateUUID();
|
|
261
|
-
nodesToUpdate.set(_pos2, _newId2);
|
|
262
|
-
seenIds.add(_newId2);
|
|
192
|
+
var existingId = node.attrs.localId;
|
|
193
|
+
var needsNewIds = !existingId || localIds.has(existingId) || seenIds.has(existingId);
|
|
194
|
+
if (needsNewIds) {
|
|
195
|
+
// No usable localId: assign a fresh unique one to every position.
|
|
196
|
+
var _iterator2 = _createForOfIteratorHelper(positions),
|
|
197
|
+
_step2;
|
|
198
|
+
try {
|
|
199
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
200
|
+
var pos = _step2.value;
|
|
201
|
+
var newId = generateUUID();
|
|
202
|
+
nodesToUpdate.set(pos, newId);
|
|
203
|
+
seenIds.add(newId);
|
|
263
204
|
modified = true;
|
|
264
205
|
}
|
|
206
|
+
} catch (err) {
|
|
207
|
+
_iterator2.e(err);
|
|
208
|
+
} finally {
|
|
209
|
+
_iterator2.f();
|
|
265
210
|
}
|
|
266
|
-
|
|
267
|
-
|
|
211
|
+
} else if (positions.size > 1) {
|
|
212
|
+
// Shared node reference: keep the existing id at the first position,
|
|
213
|
+
// assign fresh ones to the rest so they don't share the same localId.
|
|
214
|
+
seenIds.add(existingId);
|
|
215
|
+
var _Array$from = Array.from(positions),
|
|
216
|
+
_Array$from2 = (0, _toArray2.default)(_Array$from),
|
|
217
|
+
_first = _Array$from2[0],
|
|
218
|
+
rest = _arrayLikeToArray(_Array$from2).slice(1);
|
|
219
|
+
var _iterator3 = _createForOfIteratorHelper(rest),
|
|
220
|
+
_step3;
|
|
221
|
+
try {
|
|
222
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
223
|
+
var _pos = _step3.value;
|
|
224
|
+
var _newId = generateUUID();
|
|
225
|
+
nodesToUpdate.set(_pos, _newId);
|
|
226
|
+
seenIds.add(_newId);
|
|
227
|
+
modified = true;
|
|
228
|
+
}
|
|
229
|
+
} catch (err) {
|
|
230
|
+
_iterator3.e(err);
|
|
231
|
+
} finally {
|
|
232
|
+
_iterator3.f();
|
|
268
233
|
}
|
|
234
|
+
} else if (existingId) {
|
|
235
|
+
seenIds.add(existingId);
|
|
269
236
|
}
|
|
270
|
-
} catch (err) {
|
|
271
|
-
_iterator4.e(err);
|
|
272
|
-
} finally {
|
|
273
|
-
_iterator4.f();
|
|
274
237
|
}
|
|
238
|
+
} catch (err) {
|
|
239
|
+
_iterator.e(err);
|
|
240
|
+
} finally {
|
|
241
|
+
_iterator.f();
|
|
275
242
|
}
|
|
276
243
|
}
|
|
277
244
|
// Apply local ID updates based on the improvements feature flag:
|
|
@@ -86,10 +86,8 @@ export const createPlugin = api => {
|
|
|
86
86
|
const addedNodes = new Set();
|
|
87
87
|
// A single PMNode reference can appear at multiple positions in the doc (e.g.
|
|
88
88
|
// `createTable` from `prosemirror-utils` reuses cell node objects across
|
|
89
|
-
// non-header rows), so
|
|
90
|
-
// The legacy path retains the single-position-per-node map for compatibility.
|
|
89
|
+
// non-header rows), so we track every position per node identity.
|
|
91
90
|
const positionsByNode = new Map();
|
|
92
|
-
const addedNodePos = new Map();
|
|
93
91
|
const localIds = new Set();
|
|
94
92
|
const nodesToUpdate = new Map(); // position -> localId
|
|
95
93
|
|
|
@@ -138,7 +136,7 @@ export const createPlugin = api => {
|
|
|
138
136
|
step.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
139
137
|
// Scan the changed range to find all nodes
|
|
140
138
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), (node, pos) => {
|
|
141
|
-
var _node$type$spec$attrs2;
|
|
139
|
+
var _node$type$spec$attrs2, _positionsByNode$get;
|
|
142
140
|
if (ignoredNodeTypes.includes(node.type.name) || !((_node$type$spec$attrs2 = node.type.spec.attrs) !== null && _node$type$spec$attrs2 !== void 0 && _node$type$spec$attrs2.localId)) {
|
|
143
141
|
return true;
|
|
144
142
|
}
|
|
@@ -146,14 +144,9 @@ export const createPlugin = api => {
|
|
|
146
144
|
|
|
147
145
|
// Always add to addedNodes for duplicate prevention
|
|
148
146
|
addedNodes.add(node);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
positions.add(pos);
|
|
153
|
-
positionsByNode.set(node, positions);
|
|
154
|
-
} else {
|
|
155
|
-
addedNodePos.set(node, pos);
|
|
156
|
-
}
|
|
147
|
+
const positions = (_positionsByNode$get = positionsByNode.get(node)) !== null && _positionsByNode$get !== void 0 ? _positionsByNode$get : new Set();
|
|
148
|
+
positions.add(pos);
|
|
149
|
+
positionsByNode.set(node, positions);
|
|
157
150
|
return true;
|
|
158
151
|
});
|
|
159
152
|
});
|
|
@@ -175,51 +168,34 @@ export const createPlugin = api => {
|
|
|
175
168
|
hasInitializedExistingUUIDs = true;
|
|
176
169
|
// Also ensure the added have no duplicates
|
|
177
170
|
const seenIds = new Set();
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
const existingId = node.attrs.localId;
|
|
185
|
-
const needsNewIds = !existingId || localIds.has(existingId) || seenIds.has(existingId);
|
|
186
|
-
if (needsNewIds) {
|
|
187
|
-
// No usable localId: assign a fresh unique one to every position.
|
|
188
|
-
for (const pos of positions) {
|
|
189
|
-
const newId = generateUUID();
|
|
190
|
-
nodesToUpdate.set(pos, newId);
|
|
191
|
-
seenIds.add(newId);
|
|
192
|
-
modified = true;
|
|
193
|
-
}
|
|
194
|
-
} else if (positions.size > 1) {
|
|
195
|
-
// Shared node reference: keep the existing id at the first position,
|
|
196
|
-
// assign fresh ones to the rest so they don't share the same localId.
|
|
197
|
-
seenIds.add(existingId);
|
|
198
|
-
const [_first, ...rest] = Array.from(positions);
|
|
199
|
-
for (const pos of rest) {
|
|
200
|
-
const newId = generateUUID();
|
|
201
|
-
nodesToUpdate.set(pos, newId);
|
|
202
|
-
seenIds.add(newId);
|
|
203
|
-
modified = true;
|
|
204
|
-
}
|
|
205
|
-
} else if (existingId) {
|
|
206
|
-
seenIds.add(existingId);
|
|
207
|
-
}
|
|
171
|
+
for (const node of addedNodes) {
|
|
172
|
+
const positions = positionsByNode.get(node);
|
|
173
|
+
if (!positions || positions.size === 0) {
|
|
174
|
+
continue;
|
|
208
175
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
176
|
+
const existingId = node.attrs.localId;
|
|
177
|
+
const needsNewIds = !existingId || localIds.has(existingId) || seenIds.has(existingId);
|
|
178
|
+
if (needsNewIds) {
|
|
179
|
+
// No usable localId: assign a fresh unique one to every position.
|
|
180
|
+
for (const pos of positions) {
|
|
181
|
+
const newId = generateUUID();
|
|
182
|
+
nodesToUpdate.set(pos, newId);
|
|
183
|
+
seenIds.add(newId);
|
|
184
|
+
modified = true;
|
|
219
185
|
}
|
|
220
|
-
|
|
221
|
-
|
|
186
|
+
} else if (positions.size > 1) {
|
|
187
|
+
// Shared node reference: keep the existing id at the first position,
|
|
188
|
+
// assign fresh ones to the rest so they don't share the same localId.
|
|
189
|
+
seenIds.add(existingId);
|
|
190
|
+
const [_first, ...rest] = Array.from(positions);
|
|
191
|
+
for (const pos of rest) {
|
|
192
|
+
const newId = generateUUID();
|
|
193
|
+
nodesToUpdate.set(pos, newId);
|
|
194
|
+
seenIds.add(newId);
|
|
195
|
+
modified = true;
|
|
222
196
|
}
|
|
197
|
+
} else if (existingId) {
|
|
198
|
+
seenIds.add(existingId);
|
|
223
199
|
}
|
|
224
200
|
}
|
|
225
201
|
}
|
|
@@ -89,10 +89,8 @@ export var createPlugin = function createPlugin(api) {
|
|
|
89
89
|
var addedNodes = new Set();
|
|
90
90
|
// A single PMNode reference can appear at multiple positions in the doc (e.g.
|
|
91
91
|
// `createTable` from `prosemirror-utils` reuses cell node objects across
|
|
92
|
-
// non-header rows), so
|
|
93
|
-
// The legacy path retains the single-position-per-node map for compatibility.
|
|
92
|
+
// non-header rows), so we track every position per node identity.
|
|
94
93
|
var positionsByNode = new Map();
|
|
95
|
-
var addedNodePos = new Map();
|
|
96
94
|
var localIds = new Set();
|
|
97
95
|
var nodesToUpdate = new Map(); // position -> localId
|
|
98
96
|
|
|
@@ -143,7 +141,7 @@ export var createPlugin = function createPlugin(api) {
|
|
|
143
141
|
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
144
142
|
// Scan the changed range to find all nodes
|
|
145
143
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
|
|
146
|
-
var _node$type$spec$attrs2;
|
|
144
|
+
var _node$type$spec$attrs2, _positionsByNode$get;
|
|
147
145
|
if (ignoredNodeTypes.includes(node.type.name) || !((_node$type$spec$attrs2 = node.type.spec.attrs) !== null && _node$type$spec$attrs2 !== void 0 && _node$type$spec$attrs2.localId)) {
|
|
148
146
|
return true;
|
|
149
147
|
}
|
|
@@ -151,14 +149,9 @@ export var createPlugin = function createPlugin(api) {
|
|
|
151
149
|
|
|
152
150
|
// Always add to addedNodes for duplicate prevention
|
|
153
151
|
addedNodes.add(node);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
positions.add(pos);
|
|
158
|
-
positionsByNode.set(node, positions);
|
|
159
|
-
} else {
|
|
160
|
-
addedNodePos.set(node, pos);
|
|
161
|
-
}
|
|
152
|
+
var positions = (_positionsByNode$get = positionsByNode.get(node)) !== null && _positionsByNode$get !== void 0 ? _positionsByNode$get : new Set();
|
|
153
|
+
positions.add(pos);
|
|
154
|
+
positionsByNode.set(node, positions);
|
|
162
155
|
return true;
|
|
163
156
|
});
|
|
164
157
|
});
|
|
@@ -180,91 +173,65 @@ export var createPlugin = function createPlugin(api) {
|
|
|
180
173
|
hasInitializedExistingUUIDs = true;
|
|
181
174
|
// Also ensure the added have no duplicates
|
|
182
175
|
var seenIds = new Set();
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
var existingId = node.attrs.localId;
|
|
194
|
-
var needsNewIds = !existingId || localIds.has(existingId) || seenIds.has(existingId);
|
|
195
|
-
if (needsNewIds) {
|
|
196
|
-
// No usable localId: assign a fresh unique one to every position.
|
|
197
|
-
var _iterator2 = _createForOfIteratorHelper(positions),
|
|
198
|
-
_step2;
|
|
199
|
-
try {
|
|
200
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
201
|
-
var pos = _step2.value;
|
|
202
|
-
var newId = generateUUID();
|
|
203
|
-
nodesToUpdate.set(pos, newId);
|
|
204
|
-
seenIds.add(newId);
|
|
205
|
-
modified = true;
|
|
206
|
-
}
|
|
207
|
-
} catch (err) {
|
|
208
|
-
_iterator2.e(err);
|
|
209
|
-
} finally {
|
|
210
|
-
_iterator2.f();
|
|
211
|
-
}
|
|
212
|
-
} else if (positions.size > 1) {
|
|
213
|
-
// Shared node reference: keep the existing id at the first position,
|
|
214
|
-
// assign fresh ones to the rest so they don't share the same localId.
|
|
215
|
-
seenIds.add(existingId);
|
|
216
|
-
var _Array$from = Array.from(positions),
|
|
217
|
-
_Array$from2 = _toArray(_Array$from),
|
|
218
|
-
_first = _Array$from2[0],
|
|
219
|
-
rest = _arrayLikeToArray(_Array$from2).slice(1);
|
|
220
|
-
var _iterator3 = _createForOfIteratorHelper(rest),
|
|
221
|
-
_step3;
|
|
222
|
-
try {
|
|
223
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
224
|
-
var _pos = _step3.value;
|
|
225
|
-
var _newId = generateUUID();
|
|
226
|
-
nodesToUpdate.set(_pos, _newId);
|
|
227
|
-
seenIds.add(_newId);
|
|
228
|
-
modified = true;
|
|
229
|
-
}
|
|
230
|
-
} catch (err) {
|
|
231
|
-
_iterator3.e(err);
|
|
232
|
-
} finally {
|
|
233
|
-
_iterator3.f();
|
|
234
|
-
}
|
|
235
|
-
} else if (existingId) {
|
|
236
|
-
seenIds.add(existingId);
|
|
237
|
-
}
|
|
176
|
+
var _iterator = _createForOfIteratorHelper(addedNodes),
|
|
177
|
+
_step;
|
|
178
|
+
try {
|
|
179
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
180
|
+
var node = _step.value;
|
|
181
|
+
var positions = positionsByNode.get(node);
|
|
182
|
+
if (!positions || positions.size === 0) {
|
|
183
|
+
continue;
|
|
238
184
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var _pos2 = addedNodePos.get(_node);
|
|
252
|
-
if (_pos2 !== undefined) {
|
|
253
|
-
var _newId2 = generateUUID();
|
|
254
|
-
nodesToUpdate.set(_pos2, _newId2);
|
|
255
|
-
seenIds.add(_newId2);
|
|
185
|
+
var existingId = node.attrs.localId;
|
|
186
|
+
var needsNewIds = !existingId || localIds.has(existingId) || seenIds.has(existingId);
|
|
187
|
+
if (needsNewIds) {
|
|
188
|
+
// No usable localId: assign a fresh unique one to every position.
|
|
189
|
+
var _iterator2 = _createForOfIteratorHelper(positions),
|
|
190
|
+
_step2;
|
|
191
|
+
try {
|
|
192
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
193
|
+
var pos = _step2.value;
|
|
194
|
+
var newId = generateUUID();
|
|
195
|
+
nodesToUpdate.set(pos, newId);
|
|
196
|
+
seenIds.add(newId);
|
|
256
197
|
modified = true;
|
|
257
198
|
}
|
|
199
|
+
} catch (err) {
|
|
200
|
+
_iterator2.e(err);
|
|
201
|
+
} finally {
|
|
202
|
+
_iterator2.f();
|
|
258
203
|
}
|
|
259
|
-
|
|
260
|
-
|
|
204
|
+
} else if (positions.size > 1) {
|
|
205
|
+
// Shared node reference: keep the existing id at the first position,
|
|
206
|
+
// assign fresh ones to the rest so they don't share the same localId.
|
|
207
|
+
seenIds.add(existingId);
|
|
208
|
+
var _Array$from = Array.from(positions),
|
|
209
|
+
_Array$from2 = _toArray(_Array$from),
|
|
210
|
+
_first = _Array$from2[0],
|
|
211
|
+
rest = _arrayLikeToArray(_Array$from2).slice(1);
|
|
212
|
+
var _iterator3 = _createForOfIteratorHelper(rest),
|
|
213
|
+
_step3;
|
|
214
|
+
try {
|
|
215
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
216
|
+
var _pos = _step3.value;
|
|
217
|
+
var _newId = generateUUID();
|
|
218
|
+
nodesToUpdate.set(_pos, _newId);
|
|
219
|
+
seenIds.add(_newId);
|
|
220
|
+
modified = true;
|
|
221
|
+
}
|
|
222
|
+
} catch (err) {
|
|
223
|
+
_iterator3.e(err);
|
|
224
|
+
} finally {
|
|
225
|
+
_iterator3.f();
|
|
261
226
|
}
|
|
227
|
+
} else if (existingId) {
|
|
228
|
+
seenIds.add(existingId);
|
|
262
229
|
}
|
|
263
|
-
} catch (err) {
|
|
264
|
-
_iterator4.e(err);
|
|
265
|
-
} finally {
|
|
266
|
-
_iterator4.f();
|
|
267
230
|
}
|
|
231
|
+
} catch (err) {
|
|
232
|
+
_iterator.e(err);
|
|
233
|
+
} finally {
|
|
234
|
+
_iterator.f();
|
|
268
235
|
}
|
|
269
236
|
}
|
|
270
237
|
// Apply local ID updates based on the improvements feature flag:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-local-id",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.4",
|
|
4
4
|
"description": "LocalId plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"atlaskit:src": "src/index.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaskit/adf-schema": "^56.
|
|
23
|
+
"@atlaskit/adf-schema": "^56.7.0",
|
|
24
24
|
"@atlaskit/editor-plugin-collab-edit": "^15.0.0",
|
|
25
25
|
"@atlaskit/editor-plugin-composition": "^13.0.0",
|
|
26
26
|
"@atlaskit/editor-plugin-limited-mode": "^11.0.0",
|
|
27
27
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
28
28
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
29
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
29
|
+
"@atlaskit/tmp-editor-statsig": "^146.0.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0",
|
|
31
31
|
"raf-schd": "^4.0.3"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^118.
|
|
34
|
+
"@atlaskit/editor-common": "^118.4.0",
|
|
35
35
|
"react": "^18.2.0 || ^19.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|