@atlaskit/editor-plugin-local-id 4.2.2 → 4.2.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 +16 -0
- package/afm-jira/tsconfig.json +1 -1
- package/dist/cjs/localIdPlugin.js +1 -1
- package/dist/cjs/pm-plugins/main.js +28 -10
- package/dist/es2019/localIdPlugin.js +1 -1
- package/dist/es2019/pm-plugins/main.js +28 -10
- package/dist/esm/localIdPlugin.js +1 -1
- package/dist/esm/pm-plugins/main.js +28 -10
- package/dist/types/pm-plugins/main.d.ts +6 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +6 -2
- package/package.json +6 -3
- package/afm-dev-agents/tsconfig.json +0 -27
- package/afm-passionfruit/tsconfig.json +0 -27
- package/afm-post-office/tsconfig.json +0 -27
- package/afm-rovo-extension/tsconfig.json +0 -27
- package/afm-townsquare/tsconfig.json +0 -27
- package/afm-volt/tsconfig.json +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-local-id
|
|
2
2
|
|
|
3
|
+
## 4.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a05464ea42678`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a05464ea42678) -
|
|
8
|
+
EDITOR-2791 bump adf-schema
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 4.2.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`be55d2a043969`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be55d2a043969) -
|
|
16
|
+
Use shorter localIds and fix duplicate bug to store less data.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 4.2.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
5
|
+
"outDir": "../../../../../jira/tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
6
6
|
"rootDir": "../",
|
|
7
7
|
"composite": true
|
|
8
8
|
},
|
|
@@ -16,6 +16,15 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
16
16
|
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; } }
|
|
17
17
|
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; }
|
|
18
18
|
var localIdPluginKey = exports.localIdPluginKey = new _state.PluginKey('localIdPlugin');
|
|
19
|
+
var generateUUID = function generateUUID(api, node, pos) {
|
|
20
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_ai_local_id_short')) {
|
|
21
|
+
var _api$core$actions$get, _api$core$actions$get2;
|
|
22
|
+
// Use the same technique as the anchor id which is faster and shorter
|
|
23
|
+
return (_api$core$actions$get = api === null || api === void 0 || (_api$core$actions$get2 = api.core.actions.getAnchorIdForNode(node, pos)) === null || _api$core$actions$get2 === void 0 ? void 0 : _api$core$actions$get2.replace('--anchor-', '')) !== null && _api$core$actions$get !== void 0 ? _api$core$actions$get : _adfSchema.uuid.generate();
|
|
24
|
+
}
|
|
25
|
+
// When the flag is NOT enabled, existing uuid
|
|
26
|
+
return _adfSchema.uuid.generate();
|
|
27
|
+
};
|
|
19
28
|
|
|
20
29
|
// Fallback for Safari which doesn't support requestIdleCallback
|
|
21
30
|
var requestIdleCallbackWithFallback = function requestIdleCallbackWithFallback(callback) {
|
|
@@ -26,7 +35,7 @@ var requestIdleCallbackWithFallback = function requestIdleCallbackWithFallback(c
|
|
|
26
35
|
requestAnimationFrame(callback);
|
|
27
36
|
}
|
|
28
37
|
};
|
|
29
|
-
var createPlugin = exports.createPlugin = function createPlugin() {
|
|
38
|
+
var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
30
39
|
return new _safePlugin.SafePlugin({
|
|
31
40
|
key: localIdPluginKey,
|
|
32
41
|
view: function view(editorView) {
|
|
@@ -51,10 +60,10 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
51
60
|
var _node$type$spec$attrs;
|
|
52
61
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId && !!((_node$type$spec$attrs = node.type.spec.attrs) !== null && _node$type$spec$attrs !== void 0 && _node$type$spec$attrs.localId)) {
|
|
53
62
|
if ((0, _platformFeatureFlags.fg)('platform_editor_localid_improvements')) {
|
|
54
|
-
nodesToUpdate.set(pos,
|
|
63
|
+
nodesToUpdate.set(pos, generateUUID(api, node, pos));
|
|
55
64
|
} else {
|
|
56
65
|
localIdWasAdded = true;
|
|
57
|
-
addLocalIdToNode(pos, tr);
|
|
66
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
return true; // Continue traversing
|
|
@@ -128,10 +137,10 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
128
137
|
} else {
|
|
129
138
|
if (!(node !== null && node !== void 0 && node.attrs.localId)) {
|
|
130
139
|
if ((0, _platformFeatureFlags.fg)('platform_editor_localid_improvements')) {
|
|
131
|
-
nodesToUpdate.set(pos,
|
|
140
|
+
nodesToUpdate.set(pos, generateUUID(api, node, pos));
|
|
132
141
|
} else {
|
|
133
142
|
// Legacy behavior - individual steps
|
|
134
|
-
addLocalIdToNode(pos, tr);
|
|
143
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
146
|
}
|
|
@@ -148,22 +157,29 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
148
157
|
localIds.add(node.attrs.localId);
|
|
149
158
|
return true;
|
|
150
159
|
});
|
|
160
|
+
// Also ensure the added have no duplicates
|
|
161
|
+
var seenIds = new Set();
|
|
151
162
|
var _iterator = _createForOfIteratorHelper(addedNodes),
|
|
152
163
|
_step;
|
|
153
164
|
try {
|
|
154
165
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
155
166
|
var node = _step.value;
|
|
156
|
-
if (!node.attrs.localId || localIds.has(node.attrs.localId)) {
|
|
167
|
+
if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId) && (0, _platformFeatureFlags.fg)('platform_editor_ai_local_id_short')) {
|
|
157
168
|
var pos = addedNodePos.get(node);
|
|
158
169
|
if (pos !== undefined) {
|
|
159
170
|
if ((0, _platformFeatureFlags.fg)('platform_editor_localid_improvements')) {
|
|
160
|
-
|
|
171
|
+
var newId = generateUUID(api, node, pos);
|
|
172
|
+
nodesToUpdate.set(pos, newId);
|
|
173
|
+
seenIds.add(newId);
|
|
161
174
|
} else {
|
|
162
|
-
addLocalIdToNode(pos, tr);
|
|
175
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
163
176
|
}
|
|
164
177
|
modified = true;
|
|
165
178
|
}
|
|
166
179
|
}
|
|
180
|
+
if (node.attrs.localId) {
|
|
181
|
+
seenIds.add(node.attrs.localId);
|
|
182
|
+
}
|
|
167
183
|
}
|
|
168
184
|
} catch (err) {
|
|
169
185
|
_iterator.e(err);
|
|
@@ -189,9 +205,11 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
189
205
|
*
|
|
190
206
|
* @param pos - The position of the node in the document
|
|
191
207
|
* @param tr - The transaction to apply the change to
|
|
208
|
+
* @param node - Node reference for integer ID generator
|
|
192
209
|
*/
|
|
193
|
-
var addLocalIdToNode = exports.addLocalIdToNode = function addLocalIdToNode(pos, tr) {
|
|
194
|
-
|
|
210
|
+
var addLocalIdToNode = exports.addLocalIdToNode = function addLocalIdToNode(api, pos, tr, node) {
|
|
211
|
+
var targetNode = node || tr.doc.nodeAt(pos);
|
|
212
|
+
tr.setNodeAttribute(pos, 'localId', generateUUID(api, targetNode, pos));
|
|
195
213
|
tr.setMeta('addToHistory', false);
|
|
196
214
|
};
|
|
197
215
|
|
|
@@ -5,6 +5,15 @@ import { stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
|
5
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
export const localIdPluginKey = new PluginKey('localIdPlugin');
|
|
8
|
+
const generateUUID = (api, node, pos) => {
|
|
9
|
+
if (fg('platform_editor_ai_local_id_short')) {
|
|
10
|
+
var _api$core$actions$get, _api$core$actions$get2;
|
|
11
|
+
// Use the same technique as the anchor id which is faster and shorter
|
|
12
|
+
return (_api$core$actions$get = api === null || api === void 0 ? void 0 : (_api$core$actions$get2 = api.core.actions.getAnchorIdForNode(node, pos)) === null || _api$core$actions$get2 === void 0 ? void 0 : _api$core$actions$get2.replace('--anchor-', '')) !== null && _api$core$actions$get !== void 0 ? _api$core$actions$get : uuid.generate();
|
|
13
|
+
}
|
|
14
|
+
// When the flag is NOT enabled, existing uuid
|
|
15
|
+
return uuid.generate();
|
|
16
|
+
};
|
|
8
17
|
|
|
9
18
|
// Fallback for Safari which doesn't support requestIdleCallback
|
|
10
19
|
const requestIdleCallbackWithFallback = callback => {
|
|
@@ -15,7 +24,7 @@ const requestIdleCallbackWithFallback = callback => {
|
|
|
15
24
|
requestAnimationFrame(callback);
|
|
16
25
|
}
|
|
17
26
|
};
|
|
18
|
-
export const createPlugin =
|
|
27
|
+
export const createPlugin = api => {
|
|
19
28
|
return new SafePlugin({
|
|
20
29
|
key: localIdPluginKey,
|
|
21
30
|
view: editorView => {
|
|
@@ -41,10 +50,10 @@ export const createPlugin = () => {
|
|
|
41
50
|
var _node$type$spec$attrs;
|
|
42
51
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId && !!((_node$type$spec$attrs = node.type.spec.attrs) !== null && _node$type$spec$attrs !== void 0 && _node$type$spec$attrs.localId)) {
|
|
43
52
|
if (fg('platform_editor_localid_improvements')) {
|
|
44
|
-
nodesToUpdate.set(pos,
|
|
53
|
+
nodesToUpdate.set(pos, generateUUID(api, node, pos));
|
|
45
54
|
} else {
|
|
46
55
|
localIdWasAdded = true;
|
|
47
|
-
addLocalIdToNode(pos, tr);
|
|
56
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
return true; // Continue traversing
|
|
@@ -119,10 +128,10 @@ export const createPlugin = () => {
|
|
|
119
128
|
} else {
|
|
120
129
|
if (!(node !== null && node !== void 0 && node.attrs.localId)) {
|
|
121
130
|
if (fg('platform_editor_localid_improvements')) {
|
|
122
|
-
nodesToUpdate.set(pos,
|
|
131
|
+
nodesToUpdate.set(pos, generateUUID(api, node, pos));
|
|
123
132
|
} else {
|
|
124
133
|
// Legacy behavior - individual steps
|
|
125
|
-
addLocalIdToNode(pos, tr);
|
|
134
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
137
|
}
|
|
@@ -139,18 +148,25 @@ export const createPlugin = () => {
|
|
|
139
148
|
localIds.add(node.attrs.localId);
|
|
140
149
|
return true;
|
|
141
150
|
});
|
|
151
|
+
// Also ensure the added have no duplicates
|
|
152
|
+
const seenIds = new Set();
|
|
142
153
|
for (const node of addedNodes) {
|
|
143
|
-
if (!node.attrs.localId || localIds.has(node.attrs.localId)) {
|
|
154
|
+
if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId) && fg('platform_editor_ai_local_id_short')) {
|
|
144
155
|
const pos = addedNodePos.get(node);
|
|
145
156
|
if (pos !== undefined) {
|
|
146
157
|
if (fg('platform_editor_localid_improvements')) {
|
|
147
|
-
|
|
158
|
+
const newId = generateUUID(api, node, pos);
|
|
159
|
+
nodesToUpdate.set(pos, newId);
|
|
160
|
+
seenIds.add(newId);
|
|
148
161
|
} else {
|
|
149
|
-
addLocalIdToNode(pos, tr);
|
|
162
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
150
163
|
}
|
|
151
164
|
modified = true;
|
|
152
165
|
}
|
|
153
166
|
}
|
|
167
|
+
if (node.attrs.localId) {
|
|
168
|
+
seenIds.add(node.attrs.localId);
|
|
169
|
+
}
|
|
154
170
|
}
|
|
155
171
|
}
|
|
156
172
|
|
|
@@ -171,9 +187,11 @@ export const createPlugin = () => {
|
|
|
171
187
|
*
|
|
172
188
|
* @param pos - The position of the node in the document
|
|
173
189
|
* @param tr - The transaction to apply the change to
|
|
190
|
+
* @param node - Node reference for integer ID generator
|
|
174
191
|
*/
|
|
175
|
-
export const addLocalIdToNode = (pos, tr) => {
|
|
176
|
-
tr.
|
|
192
|
+
export const addLocalIdToNode = (api, pos, tr, node) => {
|
|
193
|
+
const targetNode = node || tr.doc.nodeAt(pos);
|
|
194
|
+
tr.setNodeAttribute(pos, 'localId', generateUUID(api, targetNode, pos));
|
|
177
195
|
tr.setMeta('addToHistory', false);
|
|
178
196
|
};
|
|
179
197
|
|
|
@@ -9,6 +9,15 @@ import { stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
|
9
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
export var localIdPluginKey = new PluginKey('localIdPlugin');
|
|
12
|
+
var generateUUID = function generateUUID(api, node, pos) {
|
|
13
|
+
if (fg('platform_editor_ai_local_id_short')) {
|
|
14
|
+
var _api$core$actions$get, _api$core$actions$get2;
|
|
15
|
+
// Use the same technique as the anchor id which is faster and shorter
|
|
16
|
+
return (_api$core$actions$get = api === null || api === void 0 || (_api$core$actions$get2 = api.core.actions.getAnchorIdForNode(node, pos)) === null || _api$core$actions$get2 === void 0 ? void 0 : _api$core$actions$get2.replace('--anchor-', '')) !== null && _api$core$actions$get !== void 0 ? _api$core$actions$get : uuid.generate();
|
|
17
|
+
}
|
|
18
|
+
// When the flag is NOT enabled, existing uuid
|
|
19
|
+
return uuid.generate();
|
|
20
|
+
};
|
|
12
21
|
|
|
13
22
|
// Fallback for Safari which doesn't support requestIdleCallback
|
|
14
23
|
var requestIdleCallbackWithFallback = function requestIdleCallbackWithFallback(callback) {
|
|
@@ -19,7 +28,7 @@ var requestIdleCallbackWithFallback = function requestIdleCallbackWithFallback(c
|
|
|
19
28
|
requestAnimationFrame(callback);
|
|
20
29
|
}
|
|
21
30
|
};
|
|
22
|
-
export var createPlugin = function createPlugin() {
|
|
31
|
+
export var createPlugin = function createPlugin(api) {
|
|
23
32
|
return new SafePlugin({
|
|
24
33
|
key: localIdPluginKey,
|
|
25
34
|
view: function view(editorView) {
|
|
@@ -44,10 +53,10 @@ export var createPlugin = function createPlugin() {
|
|
|
44
53
|
var _node$type$spec$attrs;
|
|
45
54
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId && !!((_node$type$spec$attrs = node.type.spec.attrs) !== null && _node$type$spec$attrs !== void 0 && _node$type$spec$attrs.localId)) {
|
|
46
55
|
if (fg('platform_editor_localid_improvements')) {
|
|
47
|
-
nodesToUpdate.set(pos,
|
|
56
|
+
nodesToUpdate.set(pos, generateUUID(api, node, pos));
|
|
48
57
|
} else {
|
|
49
58
|
localIdWasAdded = true;
|
|
50
|
-
addLocalIdToNode(pos, tr);
|
|
59
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
return true; // Continue traversing
|
|
@@ -121,10 +130,10 @@ export var createPlugin = function createPlugin() {
|
|
|
121
130
|
} else {
|
|
122
131
|
if (!(node !== null && node !== void 0 && node.attrs.localId)) {
|
|
123
132
|
if (fg('platform_editor_localid_improvements')) {
|
|
124
|
-
nodesToUpdate.set(pos,
|
|
133
|
+
nodesToUpdate.set(pos, generateUUID(api, node, pos));
|
|
125
134
|
} else {
|
|
126
135
|
// Legacy behavior - individual steps
|
|
127
|
-
addLocalIdToNode(pos, tr);
|
|
136
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
128
137
|
}
|
|
129
138
|
}
|
|
130
139
|
}
|
|
@@ -141,22 +150,29 @@ export var createPlugin = function createPlugin() {
|
|
|
141
150
|
localIds.add(node.attrs.localId);
|
|
142
151
|
return true;
|
|
143
152
|
});
|
|
153
|
+
// Also ensure the added have no duplicates
|
|
154
|
+
var seenIds = new Set();
|
|
144
155
|
var _iterator = _createForOfIteratorHelper(addedNodes),
|
|
145
156
|
_step;
|
|
146
157
|
try {
|
|
147
158
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
148
159
|
var node = _step.value;
|
|
149
|
-
if (!node.attrs.localId || localIds.has(node.attrs.localId)) {
|
|
160
|
+
if (!node.attrs.localId || localIds.has(node.attrs.localId) || seenIds.has(node.attrs.localId) && fg('platform_editor_ai_local_id_short')) {
|
|
150
161
|
var pos = addedNodePos.get(node);
|
|
151
162
|
if (pos !== undefined) {
|
|
152
163
|
if (fg('platform_editor_localid_improvements')) {
|
|
153
|
-
|
|
164
|
+
var newId = generateUUID(api, node, pos);
|
|
165
|
+
nodesToUpdate.set(pos, newId);
|
|
166
|
+
seenIds.add(newId);
|
|
154
167
|
} else {
|
|
155
|
-
addLocalIdToNode(pos, tr);
|
|
168
|
+
addLocalIdToNode(api, pos, tr, node);
|
|
156
169
|
}
|
|
157
170
|
modified = true;
|
|
158
171
|
}
|
|
159
172
|
}
|
|
173
|
+
if (node.attrs.localId) {
|
|
174
|
+
seenIds.add(node.attrs.localId);
|
|
175
|
+
}
|
|
160
176
|
}
|
|
161
177
|
} catch (err) {
|
|
162
178
|
_iterator.e(err);
|
|
@@ -182,9 +198,11 @@ export var createPlugin = function createPlugin() {
|
|
|
182
198
|
*
|
|
183
199
|
* @param pos - The position of the node in the document
|
|
184
200
|
* @param tr - The transaction to apply the change to
|
|
201
|
+
* @param node - Node reference for integer ID generator
|
|
185
202
|
*/
|
|
186
|
-
export var addLocalIdToNode = function addLocalIdToNode(pos, tr) {
|
|
187
|
-
tr.
|
|
203
|
+
export var addLocalIdToNode = function addLocalIdToNode(api, pos, tr, node) {
|
|
204
|
+
var targetNode = node || tr.doc.nodeAt(pos);
|
|
205
|
+
tr.setNodeAttribute(pos, 'localId', generateUUID(api, targetNode, pos));
|
|
188
206
|
tr.setMeta('addToHistory', false);
|
|
189
207
|
};
|
|
190
208
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
4
|
import { PluginKey, type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import type { LocalIdPlugin } from '../localIdPluginType';
|
|
3
6
|
export declare const localIdPluginKey: PluginKey<any>;
|
|
4
|
-
export declare const createPlugin: () => SafePlugin<any>;
|
|
7
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<LocalIdPlugin> | undefined) => SafePlugin<any>;
|
|
5
8
|
/**
|
|
6
9
|
* Adds a local ID to a ProseMirror node
|
|
7
10
|
*
|
|
@@ -9,8 +12,9 @@ export declare const createPlugin: () => SafePlugin<any>;
|
|
|
9
12
|
*
|
|
10
13
|
* @param pos - The position of the node in the document
|
|
11
14
|
* @param tr - The transaction to apply the change to
|
|
15
|
+
* @param node - Node reference for integer ID generator
|
|
12
16
|
*/
|
|
13
|
-
export declare const addLocalIdToNode: (pos: number, tr: Transaction) => void;
|
|
17
|
+
export declare const addLocalIdToNode: (api: ExtractInjectionAPI<LocalIdPlugin> | undefined, pos: number, tr: Transaction, node: PMNode) => void;
|
|
14
18
|
/**
|
|
15
19
|
* Batch adds local IDs to nodes using a BatchAttrsStep
|
|
16
20
|
* @param nodesToUpdate Map of position -> localId for nodes that need updates
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
4
|
import { PluginKey, type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import type { LocalIdPlugin } from '../localIdPluginType';
|
|
3
6
|
export declare const localIdPluginKey: PluginKey<any>;
|
|
4
|
-
export declare const createPlugin: () => SafePlugin<any>;
|
|
7
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<LocalIdPlugin> | undefined) => SafePlugin<any>;
|
|
5
8
|
/**
|
|
6
9
|
* Adds a local ID to a ProseMirror node
|
|
7
10
|
*
|
|
@@ -9,8 +12,9 @@ export declare const createPlugin: () => SafePlugin<any>;
|
|
|
9
12
|
*
|
|
10
13
|
* @param pos - The position of the node in the document
|
|
11
14
|
* @param tr - The transaction to apply the change to
|
|
15
|
+
* @param node - Node reference for integer ID generator
|
|
12
16
|
*/
|
|
13
|
-
export declare const addLocalIdToNode: (pos: number, tr: Transaction) => void;
|
|
17
|
+
export declare const addLocalIdToNode: (api: ExtractInjectionAPI<LocalIdPlugin> | undefined, pos: number, tr: Transaction, node: PMNode) => void;
|
|
14
18
|
/**
|
|
15
19
|
* Batch adds local IDs to nodes using a BatchAttrsStep
|
|
16
20
|
* @param nodesToUpdate Map of position -> localId for nodes that need updates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-local-id",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "LocalId plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^51.
|
|
31
|
+
"@atlaskit/adf-schema": "^51.4.0",
|
|
32
32
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
33
33
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"raf-schd": "^4.0.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@atlaskit/editor-common": "^110.
|
|
38
|
+
"@atlaskit/editor-common": "^110.32.0",
|
|
39
39
|
"react": "^18.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
"platform_editor_use_localid_dedupe": {
|
|
82
82
|
"type": "boolean"
|
|
83
83
|
},
|
|
84
|
+
"platform_editor_ai_local_id_short": {
|
|
85
|
+
"type": "boolean"
|
|
86
|
+
},
|
|
84
87
|
"platform_editor_localid_improvements": {
|
|
85
88
|
"type": "boolean"
|
|
86
89
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.dev-agents.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../dev-agents/tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../platform/feature-flags/afm-dev-agents/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-dev-agents/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.passionfruit.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../passionfruit/tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../platform/feature-flags/afm-passionfruit/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-passionfruit/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.post-office.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../post-office/tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../platform/feature-flags/afm-post-office/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.rovo-extension.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../rovo-extension/tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../platform/feature-flags/afm-rovo-extension/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-rovo-extension/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.townsquare.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../townsquare/tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../platform/feature-flags/afm-townsquare/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-townsquare/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
package/afm-volt/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.volt.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../volt/tsDist/@atlaskit__editor-plugin-local-id/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../editor-common/afm-volt/tsconfig.json"
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|